Count number 1 in the row
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all, I have this range:
x=[0 0 0 1 0 1 0 0]
I want to count number 1 in this row. Could you help me? Thanks.
0 件のコメント
採用された回答
その他の回答 (3 件)
Gennaro Arguzzi
2017 年 5 月 11 日
編集済み: Gennaro Arguzzi
2017 年 5 月 11 日
z=[0 0 0 1 0 1 0 0];
a=length(z);
b=0;
for i=1:a
if(z(i)==1)
b=b+1;
end
end
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!