How to take the average of 7 rows then other 7 until the data finished and save into new tab of excel
2 views (last 30 days)
I am struggling to make a code here which will take the average of 7 rows then next 7 rows of each column(data need to analyse on the weekly basis), there are 150 columns. I want the average data to be saved in new tabs or file so I can further analyse the data. Any help would be great!
Jon on 14 Jul 2022
Edited: Jon on 14 Jul 2022
Read the data in using readmatrix.
Once you have read the table into an m by 150 array, let's call it A, then just use movmean to calculate the moving mean
B = movmean(A,7,2); % last argument set it to compute mean columnwise
You can write it back to Excel using for example writematrix.