How to arrange indices of matrix A by descending order ?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Pradya Panyainkaew
il 26 Dic 2017
Commentato: Star Strider
il 26 Dic 2017
if I have
A=[25,41,38] when I sort this matrix by descending order , I will get A=[41,38,21]
I want to arrange indices of matrix A by descending order and shows a result (B) like this
B=[2,3,1]
How to create program to get this result ?
Thanks in advance.
0 Commenti
Risposta accettata
Star Strider
il 26 Dic 2017
To get ‘B’, ask for the second output from sort:
A=[25,41,38];
[A_sorted,B] = sort(A, 'descend')
A_sorted =
41 38 25
B =
2 3 1
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices 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!