# How to shrink Matrix eg. 10830:21600 -> 361:576

1 view (last 30 days)
Beder on 9 Jan 2017
Edited: Beder on 23 Feb 2017
Hello Matlab Community, today I'm asking you for support in one specific problem I have here. I did not find any solution yet on this topic
I have elevation data (Etopo1 Global, cell registered) with 21600x10800 data points. resolution: 1arc minute
I also have a grid (Merra2, Nasa) of 576x361 data points. [-180,179 3/8][-90,90]degrees, resolution: 0.625°×0.5°.
Now I want to get an average elevation of each gridelement of Merra2.
This means, that I need to get an average of a matrix 40x37.5.
I have absolutely no idea to get this out of matlab. Ideally I could find a solution that is more flexible and could deal with completely flexible output-raster.
It is acceptable to have not 100% correct values at the south pole and at one lon-line. Is there anybody out there who can help me? Since these calculcations don't have to be performed on a regular basis, it is okay to run it within a for-loop :)
Any help is welcome. Thank you very much.
Kind regards
Walter Roberson on 23 Feb 2017
How about if the block size was (say) 3 1/3, then how would that go?
Beder on 23 Feb 2017
Edited: Beder on 23 Feb 2017
(1+2+3+5/(1/3))/(3 1/3)
(5 2/3 + 6+7+ 9 2/3)/(3 1/3)

Stephen23 on 10 Jan 2017
Edited: Stephen23 on 10 Jan 2017
If you want to interpolate (i.e. estimate values based on a fitted curve) then use one of the interpolation tools:
If you want to apply a function to blocks of data (e.g. the mean of each block) then use blockproc:
You could try using this FEX submssion (by the way, Matt J writes very good code):