Is there a way with the min function to determine all indexes that represent the minimum?

10 views (last 30 days)
[minx,indx] = min(x) will return the minimum value in the array and the location. The issue I have is that I have multiple occurrences of the minimum and would like to know all the locations. When there are multiple the function only returns the first location it finds the minimum. I can write a condition to determine it, but wondering if there is a built in way with the min function to output this information.

Accepted Answer

Walter Roberson
Walter Roberson on 26 Sep 2016
No, there is not. You need to use
indx = find(x == min(x))
or similar.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!