How do I g开发者_JAVA百科et the index of the smallest element in an array in matlab?
[C,I] = min(...)
finds the indices of the minimum values of A
, and returns them in output vector I
. If there are several identical minimum values, the index of the first one found is returned.
Use the min()
function with 2 output arguments. The first returned value will be the value, the second will be the index of that value.
精彩评论