sorting rows

I have a matrix ,i have to sort them by "time" variable plz tell how to proceed

 Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 15 de Mayo de 2012

0 votos

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)

Más respuestas (1)

Andreas Goser
Andreas Goser el 15 de Mayo de 2012

0 votos

doc sortrows

1 comentario

kash
kash el 15 de Mayo de 2012
Andreas i means sorting by "time" variable
rows sorting by "time" variable

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 15 de Mayo de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by