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

1 件のコメント

Andrei Bobrov
Andrei Bobrov 2012 年 5 月 15 日
example your data

サインインしてコメントする。

 採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 5 月 15 日

0 投票

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)

その他の回答 (1 件)

Andreas Goser
Andreas Goser 2012 年 5 月 15 日

0 投票

doc sortrows

1 件のコメント

kash
kash 2012 年 5 月 15 日
Andreas i means sorting by "time" variable
rows sorting by "time" variable

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange で Shifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by