フィルターのクリア

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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by