%% Create Tall Array
% Convert a datastore into a tall array.
% First, create a datastore for the data set. You can specify either a full or relative file location for the data set using datastore(location) to create the datastore. The location argument can specify:
% A single file, such as 'airlinesmall.csv'
% Several files with the same extension, such as '*.csv'
% An entire folder of files, such as 'C:\MyData'
% tabularTextDatastore also has several options to specify file and text format properties when you create the datastore.
%
% Create a datastore for the airlinesmall.csv data set. Treat 'NA' values as missing data so that they are replaced with NaN values. Select a small subset of the variables to work with.

varnames = {'ArrDelay', 'DepDelay', 'Origin', 'Dest'};
ds = tabularTextDatastore('airlinesmall.csv', 'TreatAsMissing', 'NA', ...
    'SelectedVariableNames', varnames);

%
% Use tall to create a tall array for the data in the datastore. Since the data in ds is tabular, the result is a tall table. If the data is not tabular, then tall creates a tall cell array instead.

T = tall(ds)

% You can use many common MATLAB® operators and functions to work with tall arrays. To see if a function works with tall arrays, check the Extended Capabilities section at the bottom of the function reference page.
% Copyright 2012 The MathWorks, Inc.