underlyingType
Class of the data stored inside an array, looking through wrappers such as gpuArray.
Category: Language Fundamentals > Data Types
Syntax
t = underlyingType(X)
Returns the class name of the data that X holds.
Description
For ordinary arrays underlyingType(X) is the same as class(X). The difference appears for arrays that wrap data, such as a gpuArray or a distributed array, where class reports the wrapper and underlyingType reports the class of the numbers inside. Code that must work with or without such wrappers can call underlyingType instead of class.
Input arguments
X- Any array.
Output arguments
t- Character vector with the class name, such as
'double'or'int8'.
Example
Underlying class of ordinary arrays
underlyingType(int8(1))
underlyingType(3.5)
underlyingType(true)
underlyingType(single([1 2]))
Output
ans = 'int8'
ans = 'double'
ans = 'logical'
ans = 'single'