MATLAB: Find the position of a minimum in an array

matrixminimum

Hi there! I would like to find the position of a minimum in an array.Something like a=[ 3 4 2 6 0 9 ; 3 5 8 2 5 9] pos_min= [1,5]

Best Answer

a=[ 3 4 2 6 0 9 ; 3 5 8 2 5 9];
[min_val,idx]=min(a(:));
[row,col]=ind2sub(size(a),idx)