필터 지우기
필터 지우기

Manipulate time series matrix

조회 수: 1 (최근 30일)
Danilo M
Danilo M 2016년 8월 18일
편집: Azzi Abdelmalek 2016년 8월 18일
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

답변 (1개)

Azzi Abdelmalek
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))]

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by