www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/AdjustDataInTimetableExample.m
%% Interpolate Irregular Timetable Data to Hourly Times % Create timetable data that are approximately hourly, but with some irregularity % in the times. Interpolate the data so that the output timetable has regular % hourly row times. Time = datetime({'2015-12-18 07:02:12';'2015-12-18 08:00:47';... '2015-12-18 09:01:37';'2015-12-18 10:03:10';... '2015-12-18 10:59:34'}); Temp = [37.3;41.9;45.7;42.3;39.8]; Pressure = [30.1;29.9;30.03;29.9;29.8]; TT = timetable(Time,Temp,Pressure) %% % To resample with cubic spline interpolation, specify |'spline'|. TT2 = retime(TT,'hourly','spline')