I would like to know if it is possible to use cell functions in nested cell arrays.
Let's say I have a 3x3 cell array AB, each element of which is again a 3x3 cell array and each element of which is then for example a 3x3 matrix.
A=cell(3,3);
AB=A;
for i=1:1:3
for j=1:1:3
AB{i,j}=cell(3,3)
end
end
If I then want to do an operation in each matrix, and thus in each element of each element of the cell array (sorry it sounds horrible), how would it work?
An example would be, if you want to build the sum of the matrix rows, with something like this...
AB2=cellfun(@sum,AB);
or
AB2=cellfun(@sum,AB{:,:});
But this doesn't work. I have tried multiple combinations with anonymous functions but they didn't work either. Is there a way to do this or do I need to put the cellfun in a loop?
I would appreciate your help.
Anna