Resample multiple overlapping datetime to 1-minute (and 15-minutes) resolution?
이전 댓글 표시
Coming back again on resampling datetime....
Situation is I have many water pumps which are filled up in different time-frames. I have this table with multiple overlapping time and the total volume of individual pumps. Each row is basically a different water pump.
Column 1 (Start time), Column 2 (End time), Column 3 (Volume)
I want to sample the data to minute resolution (also 15 mins resolution) with the specified volume.
Example:
Pump1: 00:04:34 06:33:34 56
Pump2: 00:10:09 09:50:01 93
What I want it
00:04:00 56
00:05:00 56
....
00:10:00 56+93
00:11:00 56+93
....
06:34:00 93
As you can see, it sums up when there is overlapping time. Or else it is the only volume.
I have attached the actual table as well.
Thanks!
댓글 수: 7
Continuing from https://www.mathworks.com/matlabcentral/answers/476451-resample-datetime-to-minute-resolution
How does this differ from the solution in the previous question (link above)?
Also, where is the overlapping time? Maybe a longer, complete example would be helpful.
Alex
2019년 8월 21일
That is called a cumulative sum. For example,
example.Volume = cumsum(example.Volume);
Alex
2019년 8월 21일
Adam Danz
2019년 8월 21일
The data in your example is all from the same day so it looks like you just need to apply the cumsum() like I showed in my previous comment.
Alex
2019년 8월 21일
I think I understand now. After you've interpolated the time stamps to minute resolution and replicated the volumne values, (as was demonstrated here), you get a timetable with two columns. Can you just apply the cumulative sum to the "vol" column? I haven't looked too closely as to why that wouldn't work.
[Update]
I think Steven's approach below is the way to go.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
