MATLAB: Mean value of each cell of 2D grid

cell valuesgridmean valuessurfacetemperature map

Hi I am trying to solve a problem that has x,y data and f(x,y). It's a 2D temp map with f(x,y) being temperature values.
I have too many x (3000 values) and y (3000) values and f(x,y) (3000) values.
When I plot surface 2D it generates very odd map with too much of data. To avoid that I am looking to reduce the number of grid points by taking some avg. This way I can reduce the number of grid points.
Can any one has suggestions how to do matlab code for this?

Best Answer

Look at Jan's answer here. He provides MATLAB code and a refernce to the File Exchange. For your convienance:
X = rand(20, 30);
R = reshape(X, 2, 10, 2, 15);
S = sum(sum(R, 1), 3) * 0.25;
Y = reshape(S, 10, 15);