%% Interpolate Timetable Data to Time Vector
% Create a timetable that contains times, temperature, and pressure readings.

Time = datetime({'2015-12-18 07:29:53';'2015-12-18 08:00:00';...
                 '2015-12-18 08:31:02';'2015-12-18 09:30:00'});
Temp = [37.3;41.9;45.7;39.8];
Pressure = [30.1;29.9;30.03;29.8];
TT1 = timetable(Time,Temp,Pressure)

%
% Create a time vector and interpolate the timetable data at the times in the vector. This time vector starts at 8:00 AM. If you instead use the 'TimeStep' name-value pair argument, then the output timetable would start at 7:00 AM. One reason to use a time vector is to ensure that the output timetable starts, and ends, with times you specify.

newTimes = [datetime('2015-12-18 08:00:00'):minutes(30):datetime('2015-12-18 09:30:00')];
TT2 = retime(TT1,newTimes,'linear')

% Copyright 2012 The MathWorks, Inc.