%% Detect and Use Import Options for Text Files
% Create import options, tailor the data types for multiple variables, and then read the data.
% Create an import options object from a text file.

opts = detectImportOptions('airlinesmall.csv')

%
% Examine the Type property of the variables TaxiIn and TaxiOut.

getvaropts(opts,{'TaxiIn','TaxiOut'})

%
% Change the type of the variables TaxiIn and TaxiOut to double.

 opts = setvartype(opts,{'TaxiIn','TaxiOut'},'double');

%
% Specify the subset of variables to import and examine.

opts.SelectedVariableNames = {'TaxiIn','TaxiOut'};

%
% Use the readtable function along with the options object to import the selected variables. Display a summary of the table.

T = readtable('airlinesmall.csv',opts);
summary(T)

% Copyright 2012 The MathWorks, Inc.