Sorting Vectors descending order

13 ビュー (過去 30 日間)
Omid Ameri Sianaki
Omid Ameri Sianaki 2014 年 8 月 26 日
編集済み: Image Analyst 2014 年 8 月 26 日
I appreciate if anyone could help me for writing below sorting for different vectors: Assumed :
A1= (a1,a2)
A2= (a3,a4)
A3=(a5,a6)
.
.
An= (ai, aj)
How can I sort A1, A2, … ,An. by just first member comparison descending order (1) or second comparison (2), or both member comparison (3): solution : (for example)
1) a3>a1>a5 ---> output: A2, A1, A5...
or
2) a6>a4>a2 ----> output: A3,A2,A1
3) a1>a3 >a5 and a2>a4 >a6 --->output: A1, A2,A3

採用された回答

Star Strider
Star Strider 2014 年 8 月 26 日
The sortrows function is probably what you want. See specifically Sort Rows of a Matrix
  6 件のコメント
Omid Ameri Sianaki
Omid Ameri Sianaki 2014 年 8 月 26 日
編集済み: Image Analyst 2014 年 8 月 26 日
Awesome! Perfect Answer. Thank you very much. Yes it was what I wanted and I appreciate for your time.
Star Strider
Star Strider 2014 年 8 月 26 日
My pleasure!
That was a really fun problem for me!

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

その他の回答 (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