How can I aggregate rows by a specified start time and time step in a time table?
4 ビュー (過去 30 日間)
古いコメントを表示
I have 15-minute schedules and I want to aggregate time steps with given start time using mean, sum, max, and so on. I've already tried to use the retime function, but it only makes the sum to the next full hour and I need the sum of the next hour. For instance the sum of Load for the next hour starting at 14:30 and including the time steps 14:45, 15:00, 15:15 ...
TStep = hours(1);
AggregateSchedule = retime(Schedule,'regular','sum','TimeStep',TStep);
DateTime ID Load RL Price
___________________ __________ ____ __ _____
14.06.2018 14:30:00 7617 6148 0 250
14.06.2018 14:45:00 7617 6253 0 250
14.06.2018 15:00:00 7617 6358 0 250
14.06.2018 15:15:00 7617 6463 0 250
14.06.2018 15:30:00 7617 6568 0 250
14.06.2018 15:45:00 7617 6673 0 250
14.06.2018 16:00:00 7617 6778 0 250
14.06.2018 16:15:00 7617 6883 0 250
Many thanks in advance!
0 件のコメント
採用された回答
Guillaume
2018 年 6 月 14 日
My suggestion would be to subtract 30 minutes from your datetime column, retime it as you've done then add the 30 minutes back:
Schedule.Properties.RowTimes = Schedule.Properties.RowTimes - minutes(30);
AggregateSchedule = retime(Schedule, 'hourly', 'sum');
AggregateSchedule.Properties.RowTimes = AggregateSchedule.Properties.RowTimes + minutes(30);
2 件のコメント
Peter Perkins
2018 年 7 月 3 日
編集済み: Peter Perkins
2018 年 7 月 5 日
As I suspect that link describes, retime will happily aggregate on the half-hours, it's just a little bit more work than using 'hourly'. Create an explicit target time vector as something like
target = datetime(2018,6,14,14,30,0):minutes(30):datetime(...)
Also, beginning in R2018a, there's a new syntax to make that easier:
tt = retime(tt,'regular',method,'TimeStep',minutes(30))
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!