필터 지우기
필터 지우기

Adding cell array elements

조회 수: 11 (최근 30일)
Michael
Michael 2014년 7월 1일
댓글: Cedric 2014년 7월 1일
I have a cell array filled with elements of
C=
[541x541x3 uint8]
[541x541x3 uint8]
[541x541x3 uint8]
[541x541x3 uint8]
I am trying to figure out how to add the four arrays together so that the final sum is of the form
[541x541x3 uint8]
Literally typing out C{1} + C{2} + ... (and so on) will work, but I need this process to be automated and to work for any sized cell. Any help would be appreciated!
  댓글 수: 1
Cedric
Cedric 2014년 7월 1일
I deleted my answer because when I wrote it I didn't realize that the sum should be uint8 as well.

댓글을 달려면 로그인하십시오.

채택된 답변

Sara
Sara 2014년 7월 1일
If all the cells are consistent:
mysum = C{1};
for i = 2:numel(C)
mysum = mysum + C{i};
end
  댓글 수: 1
Michael
Michael 2014년 7월 1일
Exactly what I wanted! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by