フィルターのクリア

Number of elements in cell array

9 ビュー (過去 30 日間)
Ishan Gawai
Ishan Gawai 2021 年 3 月 12 日
コメント済み: Ishan Gawai 2021 年 3 月 13 日
Consider following code and I want find total number of elements in a. I want the answer to be 17.
a = {2};
a(2) = {magic(4)};
  1 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 3 月 12 日
yes
total number of a array is 17
a{:}
ans =
2
ans =
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1

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

採用された回答

Balazs Fischer
Balazs Fischer 2021 年 3 月 12 日
sum(cellfun('prodofsize',a))
it gets more complicated when a contains other cell arrays.
  1 件のコメント
Ishan Gawai
Ishan Gawai 2021 年 3 月 13 日
Thank you very much :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by