Dear Experts, I am trying to count , how many logical ones I have in my cell array.
I was trying these way's:
idx = find([mycell{:}] == 1);
idx=cellfun(@(c)any(c==1),mycell);
idx=cellfun(@(c)any(c>0),mycell);
These do not work.
Please, find a example cell array attached and share your opinions!
MAny thanks
lg

 採用された回答

Walter Roberson
Walter Roberson 2021 年 6 月 30 日

0 投票

cellfun(@nnz, mycell)

1 件のコメント

Levente Gellért
Levente Gellért 2021 年 6 月 30 日
Dear Walter Roberson, that's great, I did not know the function nnz, Thanks for your help. lg

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by