How to calculate monthly data from daily rainfall data in a time-seris 3-dimensional matrix?

3 次查看(过去 30 天)
I have a matrix with the size of 17 x 22 x 332. 17 stands for Latitude, 22 Longitude and 322 is days starts from Apr 1st, 2014 to Feb. 26st, 2015. At the end I should have a matrix with the size of 17 x 22 x 11.
I have tried different ways using reshape, permute etc. but I couldn't find the right way.
Since in the fiture I might use data from longer time-period (for example 15 years) I would like to derive aggregated rainfall for each month using datetime or timetable function, if possible.
I would appreciate any help.

采纳的回答

Walter Roberson
Walter Roberson 2019-3-16
mat2cell() to break the 17 x 22 x 332 up into cell arrays 17 x 22 x number_of_days_in_month . Then you can cellfun(@(M) sum(M,3), the_cell_array, 'uniform', 0) to get a 17 x 22 x 11 cell after which you cell2mat() to get 17 x 22 x 11 array.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by