MATLAB: Array index of minimum value of a matrix

array index of minimum value

Hi,
I have a 2d matrix.I need to find out the minimum value of the matrix and the corresponding row and column index.
min function will return only one index.

Best Answer

X = randn(10,10);
[minval,ind] = min(X(:));
[I,J] = ind2sub([size(X,1) size(X,2)],ind);