sorting rows

8 Ansichten (letzte 30 Tage)
kash
kash am 15 Mai 2012
I have a matrix ,i have to sort them by "time" variable plz tell how to proceed
  1 Kommentar
Andrei Bobrov
Andrei Bobrov am 15 Mai 2012
example your data

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 15 Mai 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)

Weitere Antworten (1)

Andreas Goser
Andreas Goser am 15 Mai 2012
  1 Kommentar
kash
kash am 15 Mai 2012
Andreas i means sorting by "time" variable
rows sorting by "time" variable

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by