How to sort the matrix according to specific row?

2 ビュー (過去 30 日間)
Ash K
Ash K 2013 年 12 月 8 日
コメント済み: sixwwwwww 2013 年 12 月 9 日
I have a population generated by pop=[pop;x;y;z;cst,fr]; where first 4 rows are x, second 3 rows are y and third 8 rows are z. cst is sum of column 1 and fr is calculated failure rate of column 2.
6 0.876
5 0.99
3 0.939
6 0.876
4 0.837
7 0.959
4 0.953
4 0.873
0 0
5 0.95
3 0.855
4 0.873
4 0.873
5 0.95
6 0.951
66 0.00032352
6 0.876
6 0.876
6 0.965
6 0.965
4 0.953
4 0.837
4 0.953
0 0
3 0.855
6 0.951
5 0.95
0 0
0 0
3 0.855
6 0.951
59 0.00038143
6 0.965
5 0.888
6 0.965
3 0.863
7 0.889
7 0.959
4 0.953
7 0.915
6 0.968
3 0.855
3 0.855
8 0.942
4 0.873
3 0.855
8 0.942
80 0.0002327
How can I sort the specific (16,32,48) rows followed by unchanged (1:15,17:31,33:47)? for example:
6 0.876
6 0.876
6 0.965
6 0.965
4 0.953
4 0.837
4 0.953
0 0
3 0.855
6 0.951
5 0.95
0 0
0 0
3 0.855
6 0.951
59 0.00038143
6 0.876
5 0.99
3 0.939
6 0.876
4 0.837
7 0.959
4 0.953
4 0.873
0 0
5 0.95
3 0.855
4 0.873
4 0.873
5 0.95
6 0.951
66 0.00032352
6 0.965
5 0.888
6 0.965
3 0.863
7 0.889
7 0.959
4 0.953
7 0.915
6 0.968
3 0.855
3 0.855
8 0.942
4 0.873
3 0.855
8 0.942
80 0.0002327
Please help!

採用された回答

sixwwwwww
sixwwwwww 2013 年 12 月 8 日
編集済み: sixwwwwww 2013 年 12 月 9 日
you can do it as follow:
For example you have your data in variable A then use following line to do it:
A(16:16:end, :) = sortrows(A(16:16:end, :), 1);
I hope it helps. Good luck!
  6 件のコメント
Ash K
Ash K 2013 年 12 月 9 日
worked! Thank you sixwwwwwww!
sixwwwwww
sixwwwwww 2013 年 12 月 9 日
you are welcome

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by