I have been looking how to do this all afternoon...
I have a cell and want to square every value in it...how do I go about doing this? I also wanted to know how to operate an arbitary function to all elements via cellfun; for example dividing pi by every element in the cell.
If you have two cells of same size and same size elements in each cell of same index; can I divide the cells so that the corresponding elements will divide? Any reading material on cells will be really useful!
n = 2;
a = mat2cell (randn(n,n),ones(n,1),ones(n,1));
b = mat2cell (randn(n,n),ones(n,1),ones(n,1));
c = cellfun(@(x) x.^2, a, 'UniformOutput', false);
d = cellfun(@(x,y) x ./ y, a, b, 'UniformOutput', false);