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

7 Ansichten (letzte 30 Tage)
[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.

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by