sorting rows
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a matrix ,i have to sort them by "time" variable plz tell how to proceed
Risposta accettata
Andrei Bobrov
il 15 Mag 2012
time1 = rand(8,1);
yourmatrix = randi(30,8);
solution:
[id,id] = sort(time1);
out = yourmatrix(id,:)
OR:
out1 = sortrows([time1(:), yourmatrix],1);
out = out1(:,2:end)
0 Commenti
Più risposte (1)
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!