Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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.
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:
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:
Much appreciate the help Werner_E. Thank you.