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

    %% Adjust Timetable by Inserting Missing Data Indicators
% Create a timetable that contains times and measurements of wind speed and 
% direction.
Time = datetime({'2015-12-18 07:00:00';'2015-12-18 08:03:47';...
                 '2015-12-18 09:00:00';'2015-12-18 10:00:00';...
                 '2015-12-18 10:59:34'});
WindSpeed = [13.4;6.5;7.3;8.5;2.3];
WindDirection = categorical({'NE';'N';'NE';'NW';'W'});
TT1 = timetable(Time,WindSpeed,WindDirection)

%%
% Adjust the data to an hourly time vector. Insert missing data indicators in 
% |TT2| where |TT1| does not have data on the hourly time vector.
TT2 = retime(TT1,'hourly')