Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Sum of cell array
Posted:
Aug 2, 2012 9:32 AM


"Antonio Valentine" <chanloha@gmail.com> wrote in message <jvd7jr$pqc$1@newscl01ah.mathworks.com>... > Hello I have less experince in using the cell array before. I need some help. > > Here it goes, > > I have a cell array "D" like this. > {29x10 cell} {40x10 cell} > {37x10 cell} [] > > Each element > >> D{1,1}{1:10,10} % go for 10 arrays. > ans = > 0 0 0 > ans = > 0 0 0 > ans = > 0 0 0 > ans = > 0 0 0 > ans = > 0 3 0 > ans = > 0 0 0 > ans = > 0 7 0 > ans = > 0 0 0 > ans = > 0 0 0 > ans = > 6 6 6 > > I want to keep the results to only 1 variable e.g., D_temp{1,1}{1,1} = [6 16 6]. > > Basically, I want to have a summation along the dimension "c"  {a,b}{c,d}. > > What are the function should I use including all the statiscal functions too.
None, you have to convert to numerical ARRAY:
% Sum C A = cat(1, D{1,1}{1:10,10}); S = sum(A,1)
Or use FORLOOP if you stick to CELL.
Bruno



