i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column

1 visualización (últimos 30 días)
i have a column matrix with zeros and ones..please give me the comment to find number of zeros in that column

Respuestas (1)

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

Categorías

Más información sobre Special Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by