Skip to main content
1-Visitor
March 25, 2014
Solved

Comparing data from two arrays

  • March 25, 2014
  • 3 replies
  • 3257 views

I am looking for the easiest way to compare the data from two arrays. I have two output arrays, each consisting of one column and several rows and I would like to compare the two to find the max value for each row. The final result should be another array with one column and the same number of rows. I've been trying if/then statements and the 'max' function but am unsure how to vectorize these equations and get them to compare the data row by row.

Thanks.

Best answer by Werner_E

The bad news are that max() can't be vectorized.

The good news are that you can write your own max.. routine based on the built-in max and this routine can be vectorized.

For future questions, please state which version of Mathcad the question relates to and attach a worksheet wherever possible.

25.03.png

3 replies

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
March 25, 2014

The bad news are that max() can't be vectorized.

The good news are that you can write your own max.. routine based on the built-in max and this routine can be vectorized.

For future questions, please state which version of Mathcad the question relates to and attach a worksheet wherever possible.

25.03.png

1-Visitor
March 25, 2014

Thanks! I'll give this a try. I'm working on an old worksheet in mathcad 15, but I also have mathcad prime 3.0 installed and could convert it if it would help.

Werner_E
25-Diamond I
March 25, 2014

Mathcad 15 is OK. Its the better and more powerful version anyway.

So for future questions turn in the sheet in whatever version you are working on.