i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
1 回表示 (過去 30 日間)
古いコメントを表示
i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
0 件のコメント
回答 (1 件)
Andrei Bobrov
2012 年 9 月 24 日
A = rand(10,1) > .6; % The initial vector - column
out = sum(~A);
or
out = nnz(~A);
参考
カテゴリ
Help Center および File Exchange で Special Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!