www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CreateTallArrayExample.m
%% 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'| % % |datastore| 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 = datastore('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(R) operators and functions to work with % tall arrays. For a list of supported functions, see: % % * <docid:import_export.bvc7_x4-1> %