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 Center および File ExchangeSpecial Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by