cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Nested Arrays Using Operators and Functions

SOLVED
astevenson-2
Newbie

Nested Arrays Using Operators and Functions

I'm using MathCAD 15 and Windows 7. From this statement in the help files regarding Nested Arrays:

Most of Mathcad's operators and functions do not work with nested arrays

Am I correct to conclude that I can't build a nested array using assignment statements? For instance I have test data that includes long periods of quiescent data intermixed with events of interest. I want to strip off the quiescent data and return a nested array of columns of varying lengths (time) of the event data to get around MathCADs limitation of only returning one value or entity from a program.

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Nested Arrays Using Operators and Functions

Just use an array index on the LHS:

View solution in original post

7 REPLIES 7

Re: Nested Arrays Using Operators and Functions

You can build a nested array by assignment, and it's certainly usefull when providing output (and input) of your own-written functions.

Don't however expect functions like sin(N), |N| or ΣN to return meaningful results if N is a nested array; they might, they may not... The same goes for even simple operators. You can add two same-size matrices or vectors together; once their nested arrays that's not possible.

That's what the message tries to tell you.

Success!

Luc

Re: Nested Arrays Using Operators and Functions

OK so let's say I have found two segments of the original vector FB1 that contain test data of interest and I would like to return the results in one nested matrix.

Capture.JPG

I can't figure out what assignment statement to use to created the nested array, Voutput
Capture.JPG

or

Capture.JPG

I'm sure this has been addressed on this forum before but I couldn't find a discussion thread that fit my needs.

Re: Nested Arrays Using Operators and Functions

You wind up with an array of arrays

Re: Nested Arrays Using Operators and Functions

Just use an array index on the LHS:

View solution in original post

Re: Nested Arrays Using Operators and Functions

Doh!

Re: Nested Arrays Using Operators and Functions

Where it is so simple (once you know it). A nested array is where (at least) one element is itself an array. (the same goes for matrices, but you can also nest matrices into an array and vice versa.

For your particula example, simply  assign V1 to the fisrt element of nested vector N and V2 to the second, so:

N[0:V1

N[1:V2

Now N is a nested array.

Success!
Luc

Re: Nested Arrays Using Operators and Functions

Andy Stevenson wrote:

I'm using MathCAD 15 and Windows 7. From this statement in the help files regarding Nested Arrays:

Most of Mathcad's operators and functions do not work with nested arrays

Am I correct to conclude that I can't build a nested array using assignment statements? For instance I have test data that includes long periods of quiescent data intermixed with events of interest. I want to strip off the quiescent data and return a nested array of columns of varying lengths  (time) of the event data to get around MathCADs limitation of only returning one value or entity from a program.

You can do a lot with nested arrays - For example, I've build a complete multi-dimensional array (MDA) system with them that provides a major subset of the the standard Matlab / Mathematica / Python capabilities (it actually does a few things that Matlab doesn't (or, didn't at the time I wrote it).

What you're proposing sounds eminently feasible, but you will have to write a number of functions (or programs) to handle the data effectively - nothing too hard, though.   With one level of nesting, you could probably get away with just using the vectorize operator to apply standard functions.  The major problem with Mathcad's nested array is that the indexing isn't that consistent.

Stuart

Announcements