Number of zeros in a matrix
Mostrar comentarios más antiguos
I need to create a function where I have a matrix and the function returns the number of zeros in that matrix. I need to do this using the if condition.
Then write in a .txt file which columns had more than 12 zeros.
Can someone help me out with this?
Thank you very much.
2 comentarios
Azzi Abdelmalek
el 17 de Nov. de 2012
Why did you need to do it with if condition?
Bob Choy
el 17 de Nov. de 2012
Respuesta aceptada
Más respuestas (2)
Andrei Bobrov
el 17 de Nov. de 2012
a - your matrix
number_columns = find(sum(~a) > 12);
Walter Roberson
el 18 de Nov. de 2012
numel(M) - nnz(M)
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!