How to descend order column that have maximum values zero in MATLAB
6 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
KSSV
2017 年 3 月 31 日
A=[ 0 3 2 5 0 3 1 1 2 2; 5 8 6 6 1 0 0 2 3 3; 7 9 9 7 0 0 0 0 0 0; 8 10 10 9 9 8 10 6 5 7;] ;
[m,n] = size(A) ;
c = zeros(m,1) ;
for i = 1:m
c(i) = n-nnz(A(i,:)) ;
end
[val,idx] = sort(c) ;
A = A(idx,:) ;
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!