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에서 Data Preprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by