count numbers greater than zero, and determine among them has the highest number of count
2 ビュー (過去 30 日間)
古いコメントを表示
I have matric Y, and I want to count how many numbers (i.e. more > 0) in row, and determine the highest value
% Raw data
Y=
[1 2 0 0 0 0 0 0 0;
1 3 2 0 0 0 0 0 0;
1 4 3 2 0 0 0 0 0;
1 3 0 0 0 0 0 0 0;];
% count total numbers in each row (more > 0, i.e. dont count Zeros)
W =
[2;
3;
4;
2;];
% tell me what's the highest number in W
Z =
4
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!