How do I count the numbers of 0s and display the results?

2 Ansichten (letzte 30 Tage)
Yao
Yao am 14 Okt. 2012
Hi all,
How do I count the numbers of 0s in the results as shown below and display the results?
Thank you
Columns 1 through 12
0 0 0 0 0 0 0 0 0 0 0 0
Columns 13 through 20
0 0 0 0 0 0 0 0

Akzeptierte Antwort

José-Luis
José-Luis am 14 Okt. 2012
Bearbeitet: José-Luis am 14 Okt. 2012
your_val = sum(your_mat(:)==0);

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 2 Nov. 2012
numel(your_mat) - nnz(your_mat)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by