MATLAB: Sum the elements in the cell array

sum the elements in the cell array

a = { 1 2 3; 4 5 6; 7 8 9}
How to use the cellfun to sum the element row wise?

Best Answer

Is there a specific reason you are using a cell array? This is easy with a numeric array:
a = [ 1 2 3; 4 5 6; 7 8 9 ];
sum(a,1) % Sum down columns
sum(a,2) % Sum across rows