MATLAB: Reshape a matrix in a special manner

arrayfunMATLABmeanreshape

Hi!
how could i make this matrix reschaping:
% A=[A(:,1) A(:,2) A(:,3).....A(:,130)]
TO
C1= mean([A(:,1)....A(:,10)],2)
C2=mean([A(:,11)........A(:,20)],2)
C3=mean([A(:,21)........A(:,30)],2)
C=[C1 C2 C3……….C13]
Thank you

Best Answer

A = rand(100,130);
step = 10;
C = cell2mat(arrayfun(@(i,j) mean(A(:,i:j),2),...
1:step:length(A)-step, 1+step:step:length(A),'un',0))