Hi,
Anyone know how I can get the indices of the minimum values in an array in MATLAB.
So if I have:
x = [ 2 4 1 3 1 6];
And I do:
[a b] = min(x);
I want 'b' to equal [3 5]. However, it only returns the first index, [3].
Anyone know how I can get the indices of the minimum values in an array in MATLAB.
So if I have:
x = [ 2 4 1 3 1 6];
And I do:
[a b] = min(x);
I want 'b' to equal [3 5]. However, it only returns the first index, [3].
-
Very interesting question, I am looking into it
Perhaps this solves your problem?
[row,column] = find(x==min(x))
Perhaps this solves your problem?
[row,column] = find(x==min(x))
-
x = [2 4 1 3 1 6]
b = find( x == min(x) )
b = find( x == min(x) )