Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
I am working on expanding the functionality of an old program to be able to perform an vector of cases for an already established vector. I have worked out all of the issues within the program to calculate each reasulting array/matrix. Now I want to compare results across the matrices using the max function. Previously I had used the augment function to combine vectors, but that isn't keeping the m,n combinations needed to be compared across the matrices at each m,n. Basically, I have x number of 11 x 7 matrices that I want the maximum value for each m,n combination reported in a resulting 11 x 7 matrix.
I have inserted the image below the shows what I have described above. I want the maximum value for each m,n in this matrix for the X number of nested matrices. This example just shows 2 matrices are nested.
I would greatly appreciate the help of the community. I searched previous postings and it seems that you can't do a calculation, such as max in this situation, so I would appreciate an alternative approach.
THANKS and have a great day!!!
Solved! Go to Solution.
Try defining a new function max2 (a):=max (a) and then vectorised that over your matrix. Unfortunately, I'm Mathcadless at the moment so can't try it. If that doesn't work then it should be straightforward to write a brief program that will iterate over each element. Eg, If your array is called A
for i € 0 .. rows(A)
for j €0..cols (A)
M i, j <- max (A i, j)
M
Try defining a new function max2 (a):=max (a) and then vectorised that over your matrix. Unfortunately, I'm Mathcadless at the moment so can't try it. If that doesn't work then it should be straightforward to write a brief program that will iterate over each element. Eg, If your array is called A
for i € 0 .. rows(A)
for j €0..cols (A)
M i, j <- max (A i, j)
M
Thank you Stuart for the quick reply - I will give those a try and revert with how it goes.
Sorry! No idea what you wnat to achieve.
What I see is ONE 11x7 matrix consisting of 1x2 matrices.
What is m,n?
What is x number?
What is X number?
What should the result look like and what should it represent (in math terms).
As I understand you are looking for a number of maxima values - maxima of what?
Elegant and simple solution Stuart, THANKS!!! The first one worked with creating a new function. I am not well versed in working with nested matrices and this fits the bill.
THANKS and have a great day!!!
P.S. Sorry W.E. I wasn't clear enough. m,n are the rows and columns of the matrix. For each row,column in the matrix I have many values in nested arrays, which I noted as X arrays, and for which I want returned a single maximum value. The example in the image just shows two nested arrays.