how to calculate sum between cell

1 view (last 30 days)
Fabyola
Fabyola on 18 Oct 2021
Answered: Mathieu NOE on 18 Oct 2021
i want to ask how do i supposed to do if i had a 'A' variables that contain 1x3 cell, and in every cell have 1x7 double. and i want to sum the every column of the cell. Thanks in advance

Accepted Answer

Mathieu NOE
Mathieu NOE on 18 Oct 2021
hello
see example below :
% example data
for ci = 1:3
A{ci} = rand(1,7);
end
% do a horizontal sum
B = sum(cell2mat(A(:)),2);

More Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!