TT = retime(outdoors,'daily','mean');
TT
TT=4×4 timetable
Time Humidity TemperatureF PressureHg
2015-11-15 00:00:00 48.931 51.394 29.607
2015-11-16 00:00:00 47.924 51.571 29.611
2015-11-17 00:00:00 48.45 51.238 29.613
2015-11-18 00:00:00 49.5 50.8 29.61
Adjust Timetable Data to Regular Times
Calculate the means over six-hour time intervals. Specify a regular time step using the
'regular' input argument and the 'TimeStep' name-value pair argument.
TT = retime(outdoors,'regular','mean','TimeStep',hours(6));
TT(1:5,:)
ans=5×4 timetable
Time Humidity TemperatureF PressureHg
2015-11-15 00:00:00 48.9 51.45 29.61
2015-11-15 06:00:00 48.9 51.45 29.6
2015-11-15 12:00:00 49.025 51.45 29.61
2015-11-15 18:00:00 48.9 51.225 29.607
2015-11-16 00:00:00 48.5 51.4 29.61
As an alternative, you can specify a time vector that has the same six-hour time intervals.
Specify a format for the time vector to display both date and time when you display the
timetable.
tv = datetime(2015,11,15):hours(6):datetime(2015,11,18);
tv.Format = 'dd-MMM-yyyy HH:mm:ss';
TT = retime(outdoors,tv,'mean');
TT(1:5,:)
ans=5×4 timetable
Time Humidity TemperatureF PressureHg
Resample and Aggregate Data in Timetable