Aggregate time table for working hours

I am trying to aggregate the data over 5 min interval for the log that is related to several years of a device. The data is being recorded in uneven interval (1 s ,2 min , ...) and the device is working in uneven hours ( 1 pm - 9pm, 8 am -10 pm, 9 am -12 pm , 5 pm- 10 pm , ...). When I create a uniform time, I am aggregating the data for the time that the device is not working as well, and that lead to a very large timetable, is there any work around this to only aggregate over ( 5 min) for the working hour time that is in my original time table . I appreciate if anyone can help. Thanks.
MinTime=min(SyncedData2.Time); MaxTime=max(SyncedData2.Time);
newTimes = [MinTime:minutes(NumberOfMinute):MaxTime];
SyncedDataMean = retime(SyncedData2,newTimes,'mean');

Antworten (1)

Peter Perkins
Peter Perkins am 25 Jan. 2018

1 Stimme

Behi, your code is telling retime to create all those rows. I think you have three options:
  1. Just delete the rows of SyncedDataMean whose data variable(s?) is NaN (no data => mean is NaN)
  2. Somehow figure out which time bins have no data in them before calling retime, and create newTimes accordingly.
  3. Let's say want 15min bins. You might round each element of SyncedData2.Time to the previous whole 15min, then use the unique values of that as the bin edges for retime. Some bins will then be larger than 15min, but only where there is no data anyway

Kategorien

Gefragt:

am 24 Jan. 2018

Beantwortet:

am 25 Jan. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by