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

    %% Create Table from Spreadsheet Including Row Names  

% Copyright 2015 The MathWorks, Inc.


%% 
% Create a table from a spreadsheet that contains variable names in the
% first row and row names in the first column. 
T = readtable('patients.xls','ReadRowNames',true);  

%% 
% Display the first five rows and first four variables of the table. 
T(1:5,1:4)  

%% 
% View the |DimensionNames| property of the table. 
T.Properties.DimensionNames 

%%
% |'LastName'| is the name in the first column of the first row of the spreadsheet.