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

1 view (last 30 days)
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

Accepted Answer

José-Luis
José-Luis on 14 Oct 2012
Edited: José-Luis on 14 Oct 2012
your_val = sum(your_mat(:)==0);

More Answers (1)

Walter Roberson
Walter Roberson on 2 Nov 2012
numel(your_mat) - nnz(your_mat)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!