04-May-2017 60 44 0.2 Hail
05-May-2017 62 45 0 None
06-May-2017 NaN NaN NaN
07-May-2017 NaN NaN NaN
08-May-2017 56 40 0 None
09-May-2017 59 42 0.15 Thunder
10-May-2017 60 45 0 None
Synchronize Timetables That Contain Continuous and Discrete Data
The synchronize function also fills in output timetable variables using different
methods, depending on the values specified in the VariableContinuity property of
each input timetable.
Create a second timetable that contains pressure readings in millibars from a second
weather station. The timetable has simulated readings from May 4 to May 8, 2017.
Date = datetime(2017,5,4:8)';
Pressure = [995 1003 1013 1018 1006]';
Station2 = timetable(Date,Pressure)
Station2=5×2 timetable
Date Pressure
04-May-2017 995
05-May-2017 1003
06-May-2017 1013
07-May-2017 1018
08-May-2017 1006
Synchronize the data from the two stations using the synchronize function.
synchronize fills in values for variables from Station1 according to the values in the
VariableContinuity property of Station1. However, since the
VariableContinuity property of Station2 is empty, synchronize fills in Pressure
with NaN values.
BothStations = synchronize(Station1,Station2)
BothStations=7×6 timetable
Date Tmax Tmin PrecipTotal WXEvent Pressure
Retime and Synchronize Timetable Variables Using Different Methods