Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Having 2-dimensional array,A, I want to find minimum number in the array. However I can have more than one of that number. How can I find the [row col] of all minimum value? Example:
A
2 3 4 2 1 6 7 1 9 8 3 1
It should return [2,1] [2,4] [3,4]
find will do the trick:
[I,J] = find(A == min(A(:)) ); disp([I J]) 2 1 2 4 3 4
Add a comment
I belive this should work
[row,col]=find(a==min(a(:)))
where a is your matrix. Find can also output a linear index if you give just one output.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.