I am trying to perform a binning average. I am using the code:
Avg = mean(reshape(a,300,144,27));
AvgF = squeeze(Avg);
The last line gets rid of singleton dimensions.
So as can be seen I am averaging over 300 points. It works fine except for times when I have a total number of points not equal to a multiple of 144*300.
Is there any way to make this binning average work even when the total number of points is not a multiple of 144*300?
EDIT: Sorry if my question sounded confusing. To clarify...
I have a file with 43200 rows and 27 columns. I am averaging by binning 300 rows at a time, which means in the end I am left with a matrix of size 144-by-27.
My code as I wrote it above works only when I have exactly 43200 rows. In some cases I have 43199, 43194, etc.. The reshape function works when I have a total number of rows that is a multiple of 300 (the bin size). Is there a way to make this binning average work when my total number of rows is not a multiple of 300?