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

    %% Convert Table with Separate Time Vector
% Convert a table to a timetable by adding a separate time vector that contains 
% the row times. All the table variables become variables of the timetable.

Reading1 = [98;97.5;97.9;98.1;97.9];
Reading2 = [120;111;119;117;116];
T = table(Reading1,Reading2)

%%
Time = [seconds(1):seconds(1):seconds(5)];
TT = table2timetable(T,'RowTimes',Time)