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

    %% Determine Underlying Class of Tall Arrays
% All tall tables and arrays belong to the |tall| class. However, the
% _underlying_ data type of a tall array can vary.
%
% Create a datastore 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. Convert the datastore
% into a tall table.
varnames = {'Year', 'UniqueCarrier'};
ds = datastore('airlinesmall.csv','TreatAsMissing','NA',...
    'SelectedVariableNames',varnames);
tt = tall(ds)

%%
% Determine the class of the tall table |tt| and the first table variable
% |Year|.
class(tt)

%%
class(tt.Year)

%%
% Determine the underlying data types of |tt|, as well as the |Year| and
% |UniqueCarrier| table variables.
classUnderlying(tt)

%%
classUnderlying(tt.Year)

%%
classUnderlying(tt.UniqueCarrier)

%%
% In some cases, the result returned by |classUnderlying| is an unevaluated
% tall array. Unevaluated tall arrays can be evaluated using the |gather|
% function to bring the result into memory.