www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ShiftTimetableDataExample.m
%% Shift Timetable Data % Create a timetable with temperature data as the variable. Shift the data % forward in time by one time step and compare it to the original timetable. 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) %% TT2 = lag(TT) %% % Synchronize the two timetables for comparison. Since the timetables % already have the same row times, |synchronize| renames the variables % and horizontally concatenates them. synchronize(TT,TT2)