%% Detect and Use Import Options for Spreadsheet Files
% Detect import options for a spreadsheet file, specify the variables to import, and then read the data.
% Create an import options object from a file.

opts = detectImportOptions('patients.xls')

%
% Modify the options object to specify which variables to import.

opts.SelectedVariableNames = {'Systolic','Diastolic'};

%
% Use readtable along with the options object to import the specified variables.

T = readtable('patients.xls',opts);
summary(T)

% Copyright 2012 The MathWorks, Inc.