Summing matrices of cell arrays
조회 수: 3 (최근 30일)
이전 댓글 표시
So i have three cell class variables size of 101x5. I need to combine the three of them to form only one cell array of size 101X5. I have tried concatinating the matrices before summing them and I get an error saying "Undefined function 'sum' for input arguments of type 'cell'."How can I get around this?
댓글 수: 0
채택된 답변
Walter Roberson
2012년 6월 14일
num2cell( sum( cat(3,cell2mat(V1), cell2mat(V2), cell2mat(V3)), 3) )
This depends upon the individual cells holding scalars. If they do not then
cellfun(@(A,B,C) A+B+C, V1, V2, V3, 'Uniform', 0)
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!