how can i calculate how many number of times that 1 occurs.
1 回表示 (過去 30 日間)
古いコメントを表示
I have an array like this
x =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
how can i calculate how many number of times that 1 occurs.
0 件のコメント
採用された回答
Azzi Abdelmalek
2014 年 12 月 13 日
編集済み: Azzi Abdelmalek
2014 年 12 月 13 日
x=repmat(1:4,4,1) % Example
out=sum(x(:)==1)
%or
out=nnz(x==1)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!