Here is the solution for summing row of each matrix with a cell , if you read the documentation of cellfun carefully, I think you should be able to get it.
clc;
clear all;
a=cell(3,3);
for i=1:3
for j=1:3
a{i,j}=randi(10,[9 9]);
end
end
row_sum_cell=cellfun(@(a) sum(a,2),a,'UniformOutput',false);
The following solution sums the entire row across the cell array:
clc;
clear all;
a=cell(3,3);
for i=1:3
for j=1:3
a{i,j}=randi(10,[9 9]); %generating the cell array
end
end
[r,c]=size(a); %getting the size of the array to concatenate it at runtime
horzCat_A=cell(r,1);
for i=1:r
for j=1:c
horzCat_A{i,1}=[horzCat_A{i,1} a{i,j}]; %concatenating
end
end
%after getting a concatenated matrix, apply a cellfun same as in previous example.
cell_row_sum=cellfun(@(horzCat_A) sum(horzCat_A,2),horzCat_A,'UniformOutput',false);