MATLAB: How to know what at iteration is the minimum value occuring

celliterationmatrix

Hi All
Suppose I have a matrix A [ 9 8 6 7 8 2 5 9 6 ] . The minimum occurs at the 6th element. What code does one use to find the iteration number or matrix element where the required value is to be seen ?

Best Answer

doc min
A = [ 9 8 6 7 8 2 5 9 6 ] ;
[val,idx] = min(A)