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

3 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Mar 2019
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.

Plus de réponses (0)

Catégories

En savoir plus sur Data Preprocessing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by