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? %
댓글 수: 0
채택된 답변
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 Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!