Get Help

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
- :
- Extracting values from a matrix in a program

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

Showing results for

Highlighted

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

05-15-2020
12:26 PM

05-15-2020
12:26 PM

Hi All-

I am attempting to model the first-order change of A --> B. The little programming loop below does the transformation of A to B in time steps of n just fine. The problem is I cannot view the A vs time data as is shown in the MathCAD document below.

I know there are many other ways to solve this simple system, but getting this little programming loop to solve the problem is my goal.

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

05-16-2020
12:01 PM

05-16-2020
12:01 PM

6 REPLIES 6

Highlighted
##

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

05-15-2020
01:15 PM

05-15-2020
01:15 PM

Re: Extracting values from a matrix in a program

@Caleb01 wrote:

Hi All-

I am attempting to model the first-order change of A --> B. The little programming loop below does the transformation of A to B in time steps of n just fine. The problem is I cannot view the A vs time data as is shown in the MathCAD document below.

I know there are many other ways to solve this simple system, but getting this little programming loop to solve the problem is my goal.

Hi Caleb,

The reason your program isn't giving the expected result is that you are storing arrays. You either need to write a function/program to flatten them or store the values more directly. In this case, the latter option is the easier option. Use stack or augment when you want to create flat arrays of values.

I've only got Prime Express, so can't use programming, but I hope the following should help point you in the right direction (the program may even work!).

Cheers,

Stuart

Highlighted
##

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

05-15-2020
01:23 PM

05-15-2020
01:23 PM

Re: Extracting values from a matrix in a program

Or you could play around with indexing the variables ... a bit messier.

Cheers,

Stuart

Highlighted
##

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

05-16-2020
09:17 AM

05-16-2020
09:17 AM

Re: Extracting values from a matrix in a program

Hi Stuart,

Thanks for your help. You were spot on with the stacking. To say that I don't understand indexing and matrices fully would be an ocean of understatement. Your programing loop works wonderfully. See it in action below. I really do thank you for your insight and gracious response.

Best,

Caleb

Highlighted
##

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

05-16-2020
10:48 AM

05-16-2020
10:48 AM

Re: Extracting values from a matrix in a program

No worries, Caleb, glad it worked.

Is there a reason that you calculate v as a (nested) vector? It seems as though you're just using it as an intermediary to get the A and B vectors and then throw it away when you exit the program. It simplifies the program and makes it easier to read if you just update v at every iteration.

Cheers,

Stuart

Is there a reason that you calculate v as a (nested) vector? It seems as though you're just using it as an intermediary to get the A and B vectors and then throw it away when you exit the program. It simplifies the program and makes it easier to read if you just update v at every iteration.

Cheers,

Stuart

Highlighted

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

05-16-2020
12:01 PM

05-16-2020
12:01 PM

Highlighted
##

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

05-18-2020
08:32 AM

05-18-2020
08:32 AM

Re: Extracting values from a matrix in a program

Clean and elegant! This is the result I had envisioned when I first started this little task. I just didn't quite know how to get there. Thank you.