3

How do I get the index of the smallest element in an array in matlab?

3

2 Answers 2

6

[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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.