www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ShiftTimetableDataByTimeIntervalExample.m

    %% Shift Timetable Data by Time Interval
% Create a timetable with temperature data as the variable. Shift the data
% in time by two calendar months.
Time = datetime('2015-12-01 12:00:00') + calmonths(1:5)';
Temp = [43 37 35 39 45]';
TT = timetable(Time,Temp)

%%
TT2 = lag(TT,calmonths(2))