i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
Show older comments
i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column
Answers (1)
Andrei Bobrov
on 24 Sep 2012
A = rand(10,1) > .6; % The initial vector - column
out = sum(~A);
or
out = nnz(~A);
1 Comment
Raghavendra
on 24 Sep 2012
yes its perfect:) thanks for the info:)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!