Ranking Numbers based on Size
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ScGold
am 12 Feb. 2019
Kommentiert: Jos (10584)
am 15 Feb. 2019
I have a large dataset of numbers, and am attempting to assign a number to each of them -- ranking smallest to largest.
A = [1 5 0 9 6 4]
The following is an example, where the numbers on the right are from the row vector 'A', and the numbers on the right are "assigned" based on how large the numbers are:
1 -- 2
5 -- 4
0 -- 1
9 -- 6
6 -- 5
4 -- 3
Thank you!
1 Kommentar
Akzeptierte Antwort
Weitere Antworten (1)
Jos (10584)
am 12 Feb. 2019
Another, computationally simpler option:
A = [1 5 0 9 6 4]
[~, R] = sort(A) ;
R(R) = 1:numel(A)
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!