I\'m trying to write a script in MATLAB that finds the location of the minimum value of a 2D array of numbers. I am certain there is only 1 minimum in this array, so having
An alternate solution using an inline function will work.
>> min_index = @(matrix) find(matrix == min(reshape(matrix, [1,numel(matrix)]))); >> a=magic(30); >> [r,c]=min_index(a) r = 1 c = 8