%% Shift Timetable Data by Multiple Time Steps
% Create a timetable with temperature data as the variable. Shift the data in time by multiple time steps.

Time = datetime('2015-12-18 12:00:00') + days(1:5)';
Temp = [43 42.6 42.3 39.1 37.3]';
TT = timetable(Time,Temp)

%
% Shift the data forward two time steps.

TT2 = lag(TT,2)

%
% Shift the data backward by three time steps.

TT2 = lag(TT,-3)

% Copyright 2012 The MathWorks, Inc.