%% Designate Data Type for Imported Text Data
% Import text data as a string data type by specifying import options.
% Create an options object for the file.

opts = detectImportOptions('outages.csv');

%
% Specify which variables to import using readtable, and then show a summary. The data type of the selected variables is char.

opts.SelectedVariableNames = {'Region','Cause'};
T = readtable('outages.csv',opts);
summary(T)

%
% Import text data as a string data type, and then create import options by specifying the TextType name-value pair.

opts = detectImportOptions('outages.csv','TextType','string');

%
% Specify which variables to import using readtable, and then show a summary. The data type of the selected variables is now string.

opts.SelectedVariableNames = {'Region','Cause'};
T = readtable('outages.csv',opts);
summary(T)

% Copyright 2012 The MathWorks, Inc.