필터 지우기
필터 지우기

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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by