Aggregate time table for working hours
Mostrar comentarios más antiguos
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');
Respuestas (1)
Peter Perkins
el 25 de En. de 2018
1 voto
Behi, your code is telling retime to create all those rows. I think you have three options:
- Just delete the rows of SyncedDataMean whose data variable(s?) is NaN (no data => mean is NaN)
- Somehow figure out which time bins have no data in them before calling retime, and create newTimes accordingly.
- 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
Categorías
Más información sobre Time Series Events en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!