Data Processing: Average value of every ten values.

1 view (last 30 days)
Hi,
Currently I am analyzing data sets of unknown length and I need to take an average of every ten values. However, I do not wish to discard the remainder.
For example, my last data set has 84 values. How can I take the average of every ten values through 80 and then average the last 4 values with 6 from the previous set?
This may be a strange request, but any ideas would be greatly appreciated!!
Best Regards,
Stephen

Accepted Answer

Image Analyst
Image Analyst on 20 Jul 2012
Actually it's a very, very common request (except for the tacking on 6 additional elements part). First you need to tack on those 6 (easy enough - I figure you can do that much), then something like
array2D = reshape(your1Darray, [10, 9]);
means = mean(array2D, 1);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!