How to select between duplicated non-integer values of a matrix
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Solmaz Kahourzade
le 7 Mar 2018
Commenté : Solmaz Kahourzade
le 8 Mar 2018
A= [10.01 5.02;15.20 6.01;14.05 7.12;14.05 5.14;13.5 9.11] I need to find equal number in first column and find the minimum of the corresponding second column. [14.05 5.12] Then create a new matrix as: B= [10.01 5;15.20 6;14.05 5;13.5 9]
But I cannot use “accumarray” as my values are not integer. Would you please guide me?
0 commentaires
Réponse acceptée
Guillaume
le 7 Mar 2018
"But I cannot use “accumarray” as my values are not integer." So what?
[values, ~, subs] = unique(A(:, 1));
B = [values, accumarray(subs, A(:, 2), [], @min)]
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!