how sort just nonzero values?
7 ビュー (過去 30 日間)
古いコメントを表示
how can sort values except zero values i.e i want to sort just non zero values in c. how do that. c=[8 4 5 1 0 0 0 ];
thanks
0 件のコメント
採用された回答
Honglei Chen
2012 年 3 月 12 日
Do you want to keep all zeros at the original location? If so
c = [8 4 5 1 0 0 0];
c(c~=0) = sort(c(c~=0));
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
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!