Page 1 of 1

How to get the max values of each row in each matrix

Posted: Wed Mar 18, 2015 11:39 am
by zcmcgurk
So I am having a problem finding out how to get the maximum value in each row of a matrix. So for example say I had a 3x3 matrix with the first row being 1,2,3. The second row is 3,2,1 and finally the third row is 2,1,3. I would like to get a 3x1 vector that has values of 3,3,3.

Re: How to get the max values of each row in each matrix

Posted: Wed Mar 18, 2015 11:52 am
by TomDoan
compute [rect] x=%ranmat(3,3)
*
dec vect rowmax(%rows(x))
ewise rowmax(i)=%maxvalue(%xrow(x,i))

Re: How to get the max values of each row in each matrix

Posted: Wed Mar 18, 2015 11:59 am
by zcmcgurk
Thank you