MATLAB: Finding Max Value From Matlab Variable

max value and its corresponding value

Hi Experts,
I have a variable
out
i want to extract the max value and its corresponding cell value i.e 17531 and 3 …..i used max function i.e
a = max(out);
but it is displaying 4 17531.............I dont know why it is showing 4 instead of 3???Please help

Best Answer

That is a nice one! But in the doc it says
"If A is a matrix, then max(A) treats the columns of A as vectors and returns a row vector of largest elements."
So you maybe want to do something else? Like
[a,ix]=max(out(:,2))