Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search.
X

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

Aug 10, 2022
11:59 AM

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

Aug 10, 2022
11:59 AM

Assistance with operation comparing two column matrixes and producing result in one column matrix

I'm developing a MathCAD worksheet in Prime7 that works with data extracted from input matrices. I cannot figure out how to take two variables, each of which comprise a 12 row x 1 col matrix, and compare each pair of values row by row to find the Maximum value, then spit that row's maximum value out into a new resulting column matrix.

My last attempt at a programming block with a simple concept is at the end of the worksheet, but instead of producing a column matrix only goes straight to the last iteration value and reports it.

Worksheet attached...thanks for any help!

Solved! Go to Solution.

ACCEPTED SOLUTION

Accepted Solutions

Aug 10, 2022
01:12 PM

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

Aug 10, 2022
01:12 PM

Thats how programs in Prime work - the return value is the last value assigned in the program. So in your case its the value of the last iteration.

If you want to collect the results you have to do it yourself by assigning the values in the loop:

You missed to attach the data Excel sheet, so I created random data vectors.

BTW, instead of "for i := 0 to 12" it would be more versatile to write "for i := ORIGIN to last(L[bltens)"

Another option would be to vectorize the max-function, but max is one of a few functions which cannot be vectorized. So you would have to create a used defined function which calls max and vectorize the call of this function:

2 REPLIES 2

Aug 10, 2022
01:12 PM

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

Aug 10, 2022
01:12 PM

Thats how programs in Prime work - the return value is the last value assigned in the program. So in your case its the value of the last iteration.

If you want to collect the results you have to do it yourself by assigning the values in the loop:

You missed to attach the data Excel sheet, so I created random data vectors.

BTW, instead of "for i := 0 to 12" it would be more versatile to write "for i := ORIGIN to last(L[bltens)"

Another option would be to vectorize the max-function, but max is one of a few functions which cannot be vectorized. So you would have to create a used defined function which calls max and vectorize the call of this function:

Aug 10, 2022
04:06 PM

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

Aug 10, 2022
04:06 PM

Much appreciate the help Werner_E. Thank you.