I have a monthly time series data in matrix form with 4 columns. I want to sum up always the 3 row elements of the columns. 1-3,3-6,6-9,... ,to get quaterly data. How can I do this in matlab ?

1 次查看(过去 30 天)
sum(A(1:3)); sum(A(3:6)); sum(A(6:9)); ... % because I´ve monthly values from 1952-2013 it's impossible to solve all this in the by hand upper way. Does somebody knows, how I can create a function or something else to solve this in a faster way? %

采纳的回答

dpb
dpb 2015-12-10
I are complete years, then
reshape(sum(reshape(x,3,[])),numel(x)/(3*size(x,2)),[])
If lacking complete year, operate on the modulo/3 number of rows which do have and have to treat the remainder as special case.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by