Minimum of unique values
Afficher commentaires plus anciens
I am trying to find the minimum of vector y=[ 1 2 4 3 9 7] which corresponds to vector x= [100 100 200 200 300 300] so that the result is z=[1 3 7]
what I need is the minimum of each unique x value.
Réponse acceptée
Plus de réponses (2)
Andrei Bobrov
le 9 Mar 2016
[~,~,c] = unique(x);
z = accumarray(c(:),y(:),[],@min);
Blotter678
le 9 Mar 2016
0 votes
Catégories
En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!