%% Read Variables from Text File
% Import columns from tabular data in a text file as separate variables. First, preview the contents of the text file outages.csv and then read columns.
% Preview the data in outages.csv. The file has 6 variables.

opts = detectImportOptions('outages.csv');
preview('outages.csv',opts)

% Import the first three columns as separate variables in the workspace.

[Region,OutageTime,Loss] = readvars('outages.csv');
whos Region OutageTime Loss

% Copyright 2018 The MathWorks, Inc.