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

43 ビュー (過去 30 日間)
Sarah A
Sarah A 2020 年 4 月 20 日
コメント済み: Stephen23 2020 年 4 月 21 日
Hello,
How to count the empty cells in the attached array?
Regards,

採用された回答

Muthu
Muthu 2020 年 4 月 20 日
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 件のコメント
Sarah A
Sarah A 2020 年 4 月 20 日
it works. Thank you :)
Stephen23
Stephen23 2020 年 4 月 21 日
Much simpler and more efficient just to count the output of cellfun directly:
>> nnz(cellfun(@isempty,Out))
ans = 216

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by