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

5 ビュー (過去 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 Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by