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

回答(1 个)

Andrei Bobrov
Andrei Bobrov 2012-9-24
A = rand(10,1) > .6; % The initial vector - column
out = sum(~A);
or
out = nnz(~A);

类别

Help CenterFile Exchange 中查找有关 Special Functions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by