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

45 visualizzazioni (ultimi 30 giorni)
Hello,
How to count the empty cells in the attached array?
Regards,

Risposta accettata

Muthu
Muthu il 20 Apr 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 Commenti
Stephen23
Stephen23 il 21 Apr 2020
Much simpler and more efficient just to count the output of cellfun directly:
>> nnz(cellfun(@isempty,Out))
ans = 216

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by