MATLAB documentation says
"[C,I] = max(...) finds the indices of the maximum values of A, and returns them in output vector I."
But that does not seem to work. See below.
X = [2 8 4; 7 3 9];
[a,b] = max(X)
a =
7 8 9
b =
2 1 2
The indices could have been given as linear indices b = [ 2 3 6] so that X(b) would give the max values of columns of X in a.
It looks like an error in MATLAB because the doc says something but it does something different.
So, matrix A A = [2 6 9; 4 2 8; 3 5 1] A = 2 6 9 4 2 8 3 5 1 is actually stored in memory as the sequence 2, 4, 3, 6, 2, 5, 9, 8, 1
– Seetha Rama Raju Sanapala Sep 03 '14 at 10:24The element at row 3, column 2 of matrix A (value = 5) can also be identified as element 6 in the actual storage sequence. To access this element, you have a choice of using the standard A(3,2) syntax, or you can use A(6), which is referred to as linear indexing." – Seetha Rama Raju Sanapala Sep 03 '14 at 10:24