How to sum up numbers into a cell?

조회 수: 3 (최근 30일)
ARGY B
ARGY B 2019년 5월 7일
댓글: ARGY B 2019년 5월 7일
Hi, I have a 100x5 cell, and each element of it contains vectors of different sizes. See pic1.
The vectors contains different numbers (pic 2). So, is it possible to sum up these numbers, so the final result would be a matrix 100x5?
I know that probably this can be done with a for loop. But is there any other solution?

채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 5월 7일
If a is your cell array:
b = cellfun(@sum,a)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by