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!