MATLAB: How to average specific rows of all columns

averaging specific rows of all columns

i am having 100×32 matrix in my data set. i would like to average 20 rows of all columns, like first 20rows average, next 20 and so..on…
can any one help in this problem.

Best Answer

If I understand your question correctly, you can use the movmean command:
% Some made-up data
A = rand(100,32);
N = 20;
movingAverageA = movmean(A,[(N-1) 0]); % Trailing average of N rows
output = movingAverageA(N:N:end,:);
Related Question