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

    %% Specify Table Variable as Row Times
% Convert a table to a timetable and specify the table variable that
% becomes the time vector of the timetable.
%
% Read power outage data from the file |outages.csv| to a table. The table 
% contains both outage and restoration times.
T = readtable('outages.csv');
T(1:5,:)

%%
% Convert the table to a timetable. Specify the second variable with dates
% and times, |RestorationTime|, as the time vector of the timetable.
TT = table2timetable(T,'RowTimes','RestorationTime');
TT(1:5,:)