"cell array of the dimension 1 x 121 x 515. It represents 515 sets of 1 x 121..."
First, why the complication of a cell array: convert to a 2D array of 515x121; then the manipulations are straightforward to average over groups of N (N divisible into M, the number of rows/columns comprising the sets dimension).
If the array were that 121x515, then it's (in steps to see the process) --
[r,c]=size(x);
N=5;
m=x.';
m=reshape(m,N,[]);
m=mean(m);
m=reshape(m,c,[]);
m will now be same number of rows but averaged over N successive columns to reduce that by a factor of 1/N. And, of course, the above can all be strung together; it's just harder initially to read...
m=reshape(mean(reshape(x.',N,[])),c,[]);
When writing such expressions, don't begin from the leftmost part trying to keep track of paren's, etc. Instead start from the inside out as in the above steps; when you have the first reshape() expression, then surround it by the next set of parens for the next outer function and so on until done...it's best to practice on these kinds of things with small datasets at the command line that are small enough to see easily the full array but aren't symmetric so can watch the shape changes. A good test case here would be something like
which would be nine realizations of a very short spectrum of length four but the actual size is immaterial to the operations.
Best Answer