MATLAB: Average Values in a matrix

arrayaveragefor loopincrementmatrix manipulation

I have a 100X225 matrix- I want to average [4,4] (or other) chunks of the matrix, and place that value in a new matrix: of a smaller dimension -> 100/4,225/4 etc
I can't seem to get the looping right.

Best Answer

a=rand(100,225)
out=blockproc(a,[4 4],@(x) mean(mean(x.data)))