Assume a 10 x 3 matrix. Column 1 contains decimal numbers from +1.000 to -1.000. Columns 2 & 3 contain integers. How can I create a new 10 x 3 matrix with the numbers in column 1 arranged from +1 at top to -1 at the bottom?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Don Brohaugh
le 12 Mar 2015
Commenté : Don Brohaugh
le 12 Mar 2015
Rearrange 10 x 3 matrix so first column decimal numbers are arranged in descending order of magnitude from +1.0 to -1.0
Réponse acceptée
Stephen23
le 12 Mar 2015
>> A = [0.6,2,4;-0.2,5,3;1,3,8;-1,5,2];
>> sortrows(A,-1)
ans =
1 3 8
0.6 2 4
-0.2 5 3
-1 5 2
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!