HOW CAN I SORTED MY MATRIX DESCEND
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ali hadjer
le 22 Nov 2015
Commenté : ali hadjer
le 22 Nov 2015
I HAVE A MATRIX M=[ 1 2 3 4 5 ;1 20 54 6 40] I WANT TO SORT MY MATRIX WITHIN THE SECOND COLON WITH ASCENDING WAY TO OBTEIND THIS RESULT :
M=[3 5 2 4 1;54 40 20 6 1]
HOW CAN I DO
0 commentaires
Réponse acceptée
Andrei Bobrov
le 22 Nov 2015
Modifié(e) : Andrei Bobrov
le 22 Nov 2015
M=[ 1 2 3 4 5 ;1 20 54 6 40];
[~,ii] = sort(M(2,:),'descend');
out = M(:,ii);
or
out = sortrows(M',-2)';
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices 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!