Main Content

classUnderlying

Class of underlying data in tall array

Description

C = classUnderlying(X) returns the class of the data stored inside tall array X.

example

Examples

collapse all

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 = tabularTextDatastore('airlinesmall.csv','TreatAsMissing','NA',...
    'SelectedVariableNames',varnames);
tt = tall(ds)
tt =

  Mx2 tall table

    Year    UniqueCarrier
    ____    _____________

    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
    1987       {'PS'}    
     :            :
     :            :

Determine the class of the tall table tt and the first table variable Year.

class(tt)
ans = 
'tall'
class(tt.Year)
ans = 
'tall'

Determine the underlying data types of tt, as well as the Year and UniqueCarrier table variables.

classUnderlying(tt)
ans =

  1x5 tall char array

    'table'
classUnderlying(tt.Year)
ans =

  1x6 tall char array

    'double'
classUnderlying(tt.UniqueCarrier)
ans =

  1x4 tall char array

    'cell'

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.

Input Arguments

collapse all

Input array, specified as a tall array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | table | cell | categorical | datetime | duration | calendarDuration

Output Arguments

collapse all

Underlying class, returned as a tall array.

Tips

  • Use isaUnderlying to test whether a tall array has a particular underlying data type.

Extended Capabilities

Tall Arrays
Calculate with arrays that have more rows than fit in memory.

Version History

Introduced in R2016b