%% Retrieve Specified Number of Rows in Tall Array
% Preview the last 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 tail to view the last 20 rows of data.

varnames = {'Year','Month','ArrDelay','DepDelay','UniqueCarrier'};
ds = tabularTextDatastore('airlinesmall.csv','TreatAsMissing','NA',...
    'SelectedVariableNames',varnames);
T = tall(ds)

%

tt = tail(T,20)

%
% Collect the results into memory to view the data.

b20 = gather(tt)

% Copyright 2019 The MathWorks, Inc.