How to sort out negative and positive values of a vector?
18 ビュー (過去 30 日間)
古いコメントを表示
Shubham Mohan Tatpalliwar
2018 年 10 月 10 日
編集済み: madhan ravi
2018 年 10 月 10 日
if A= -3 -2 -1 0 1 2 3 i want to sort the negative values and positive values in a separate vector
0 件のコメント
採用された回答
madhan ravi
2018 年 10 月 10 日
編集済み: madhan ravi
2018 年 10 月 10 日
A=[ -3 -2 -1 0 1 2 3 ]
Negative_nos = sort(A(A<0))
Positive_nos = sort(A(A>=0))
Will do the trick
2 件のコメント
madhan ravi
2018 年 10 月 10 日
編集済み: madhan ravi
2018 年 10 月 10 日
sort(A(1:2)) %first two
sort(A(end-2:end)) %last three
give a vote if you find it useful
その他の回答 (0 件)
参考
カテゴリ
Help Center および 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!