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

6 visualizaciones (últimos 30 días)
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

Respuesta aceptada

José-Luis
José-Luis el 14 de Oct. de 2012
Editada: José-Luis el 14 de Oct. de 2012
your_val = sum(your_mat(:)==0);

Más respuestas (1)

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

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by