www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CreateImportOptionsSpreadsheetFileExample.m

    %% Create and Use Import Options for Spreadsheet Files
% Create 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)