Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Nested Arrays Using Operators and Functions

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
11:35 AM

12-14-2015
11:35 AM

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.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
03:17 PM

12-14-2015
03:17 PM

Just use an array index on the LHS:

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
01:31 PM

12-14-2015
01:31 PM

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
02:37 PM

12-14-2015
02:37 PM

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.

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

or

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
03:17 PM

12-14-2015
03:17 PM

Re: Nested Arrays Using Operators and Functions

You wind up with an array of arrays

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
03:17 PM

12-14-2015
03:17 PM

Just use an array index on the LHS:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
03:36 PM

12-14-2015
03:36 PM

Re: Nested Arrays Using Operators and Functions

Doh!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
03:17 PM

12-14-2015
03:17 PM

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-14-2015
02:17 PM

12-14-2015
02:17 PM

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