how to calculate no of 1 present in binary matrix in matalb

1 回表示 (過去 30 日間)
Biswajit
Biswajit 2014 年 3 月 15 日
編集済み: Azzi Abdelmalek 2014 年 3 月 15 日
how to calculate no of 1 present in binary matrix in matalb

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 3 月 15 日
編集済み: Azzi Abdelmalek 2014 年 3 月 15 日
not(A)
% Example
A=[1 0; 0 0]
B=not(A)
B=
[0 1
1 1]
% or maybe you mean number by no
out=sum(A(:))

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by