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

    %% Retrieve Specified Number of Rows in Tall Array
% Preview the first 20 rows of data in a tall table.
%
% Create a tall table for the |airlinesmall.csv| data set. Select a subset
% of the variables to work with, and treat |'NA'| values as missing data so
% that |datastore| replaces them with |NaN| values. Use |head| to view the
% first 20 rows of data.
varnames = {'Year','Month','ArrDelay','DepDelay','UniqueCarrier'};
ds = datastore('airlinesmall.csv','TreatAsMissing','NA',...
    'SelectedVariableNames',varnames);
T = tall(ds)

%%
tt = head(T,20)

%%
% Collect the results into memory to view the data.
t20 = gather(tt)