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

    %% Synchronize Timetables to Hourly Times
% Synchronize two small timetables with weather measurements to an hourly
% time vector.
%
% Load two small timetables. In each timetable, there is a row time for data 
% that was not collected on the hour. Both timetables are irregular, which
% means that the time step is different between consecutive row times.
load(fullfile(matlabroot,'examples','matlab','irregularTT'));

%% 
% Display the timetables. |TT1| and |TT2| have three rows and different variables.
TT1
TT2

%%
% Synchronize |TT1| and |TT2|, specifying |'hourly'| as the time step for
% the row times of the output timetable. |TT| has data from |TT1| and |TT2|
% where they have row times that are on the hour. |TT| has missing data
% indicators where it has a row time that |TT1| and |TT2| do not have.
TT = synchronize(TT1,TT2,'hourly')