%% Return Timetable from Tabular Text Datastore
% Use the OutputType and RowTimes name-value pairs to make tabulartextDatastore return timetables instead of tables.
%
% Create a datastore for outages.csv. Specify the 'OutputType' name-value pair as 'timetable'.

ttds = tabularTextDatastore('outages.csv','OutputType','timetable');
preview(ttds)

% When you do not also specify 'RowTimes', tabularTextDatastore uses the first datetime or duration variable as the row times. In this case, the OutageTime variable is used for the row times.
%
% Specify the 'RowTimes' option to use the restoration times (RestorationTime variable) as the row times, instead of the time of the power outages.

ttds = tabularTextDatastore('outages.csv','OutputType','timetable','RowTimes','RestorationTime');
preview(ttds)

% Copyright 2019 The MathWorks, Inc.
%
%
%