how to count the number of empty cells in an array?

37 visualizaciones (últimos 30 días)
Sarah A
Sarah A el 20 de Abr. de 2020
Comentada: Stephen23 el 21 de Abr. de 2020
Hello,
How to count the empty cells in the attached array?
Regards,

Respuesta aceptada

Muthu
Muthu el 20 de Abr. de 2020
Hello Sarah,
You can count the empty cells using the following commands
N_nonempty = find(~cellfun(@isempty,Out));
count_empty = length(Out)-length(N_nonempty);
  2 comentarios
Sarah A
Sarah A el 20 de Abr. de 2020
it works. Thank you :)
Stephen23
Stephen23 el 21 de Abr. de 2020
Much simpler and more efficient just to count the output of cellfun directly:
>> nnz(cellfun(@isempty,Out))
ans = 216

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by