MATLAB: How can i use ‘sum’ for a ‘cell array’

using sum for a cell array

Hello
i have a cell array that i want to sum the coulmns ;
A={ 1×2 double , 1×2 double
1×2 double , 1×2 double
1×2 double , 1×2 double
1×2 double , 1×2 double }

Best Answer

A = cell(4,2) ;
for i = 1:4
for j = 1:2
A{i,j} = rand(1,2) ;
end
end
B = cellfun(@sum,A)