Argmin with several minimums
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I would like to find a function returning, given an array Data of doubles, an array containing all the indices of Data's minimums. Does it exist?
Thanks!
Edit: How to do in the particular case the minimum is 1?
2 Commenti
Walter Roberson
il 25 Giu 2013
Is this a vector to be worked on, and you want to return a possible vector of indices?
Is this an array to be worked on, and the minimum is to be taken over the entire array and the indices are to be the sequential indices numbers ("ind")?
Is this an array to be worked on, and the minimum is to be taken over one of the dimensions, with a vector of indices for each collapsed dimension? e.g., min of a 2D array per row, and vector of indices per row reflecting the min over that one row?
Risposte (1)
Richard Brown
il 25 Giu 2013
It doesn't feel very satisfactory, but this will do the trick
I = find(A == min(A))
2 Commenti
Walter Roberson
il 25 Giu 2013
Yes, that will work for vector input. It will not work for array inputs, which have not really been ruled out yet (giving an example with vectors is not the same thing as saying that non-vectors will not be used.)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!