Manipulate time series matrix
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a time series matrix like this:
Yr Month Day Hour Min Precipitation-rate
1997 01 01 00 00 0.5
1997 01 01 00 15 0.2
1997 01 01 00 30 0.0
1997 01 01 00 45 0.0
1997 01 01 01 00 0.0
1997 01 01 01 15 0.0
1997 01 01 01 30 0.1
1997 01 01 01 45 0.3
1997 01 01 02 00 0.5
I need hourly data, so I want to sum precipitation values for each full hour, getting this:
1997 01 01 00 00 0.7
1997 01 01 01 00 0.4
There's a practical way to do that on Matlab?
Tks
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2016년 8월 18일
M=[1997 01 01 00 00 0.5
1997 01 01 00 15 0.2
1997 01 01 00 30 0.0
1997 01 01 00 45 0.0
1997 01 01 01 00 0.0
1997 01 01 01 15 0.0
1997 01 01 01 30 0.1
1997 01 01 01 45 0.3
1997 01 01 02 00 0.5]
[ii,jj,kk]=unique(M(:,1:4),'rows')
out=[ii accumarray(kk,M(:,6))]
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!