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

1 次查看(过去 30 天)
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

采纳的回答

José-Luis
José-Luis 2012-10-14
编辑:José-Luis 2012-10-14
your_val = sum(your_mat(:)==0);

更多回答(1 个)

Walter Roberson
Walter Roberson 2012-11-2
numel(your_mat) - nnz(your_mat)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by