Filter löschen
Filter löschen

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

35 Ansichten (letzte 30 Tage)
Sarah A
Sarah A am 20 Apr. 2020
Kommentiert: Stephen23 am 21 Apr. 2020
Hello,
How to count the empty cells in the attached array?
Regards,

Akzeptierte Antwort

Muthu
Muthu am 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 Kommentare
Sarah A
Sarah A am 20 Apr. 2020
it works. Thank you :)
Stephen23
Stephen23 am 21 Apr. 2020
Much simpler and more efficient just to count the output of cellfun directly:
>> nnz(cellfun(@isempty,Out))
ans = 216

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by