I have for example a 3d matrix like (6000 x 100 x 100) with the first array being time, or the vector I want to average. How can I create an average every 10 days so that I am left with 600 x 100 x 100, so that 10 timesteps have been averaged to produce one 2d field matrix.
I have tried using accumarray but I can't seem to get it to work…and I have tried the following code (after permuting matrix):
for x = 1:100; x for y = 1:100;
aa = squeeze(data(x,y,:)); test(x,y) = nanmean(aa(1:10:end)); endend
but then I am not sure what to do next…
Can someone help me?
thanks, Michael
Best Answer