Main Content

Data Type Identification

Determine data type of a variable

MATLAB®has many functions to identify the data type of a variable or to determine whether a variable has a specific data type. Use these functions when calling or writing code that depends on variables having specific data types.

Functions

expand all

isfloat Determine if input is floating-point array
isinteger Determine whether input is integer array
islogical Determine if input is logical array
isnumeric Determine whether input is numeric array
isreal Determine whether array uses complex storage
issparse Determine whether input is sparse
isstring Determine if input is string array
ischar Determine if input is character array
iscellstr Determine if input is cell array of character vectors
isdatetime Determine if input is datetime array
isduration Determine if input is duration array
iscalendarduration Determine if input is calendar duration array
iscell Determine if input is cell array
isstruct Determine if input is structure array
istable Determine whether input is table
istimetable Determine if input is timetable
is* Detect state
isa Determine if input has specified data type
iscategorical Determine whether input is categorical array
isenum Determine if variable is enumeration
isgraphics True for valid graphics object handles
isjava Determine if input isJavaobject
isobject Determine if input isMATLABobject
whos List variables in workspace, with sizes and types
class Class of object
underlyingType Type of underlying data determining array behavior
isUnderlyingType Determine whether input has specified underlying data type
validateattributes Check validity of array

Topics

Fundamental MATLAB Classes

There are many different data types, orclasses, that you can work with in MATLAB. You can build matrices and arrays of floating-point and integer data, characters and strings, logicaltrueandfalsevalues, and so on. Function handles connect your code with any MATLAB function regardless of the current scope. Tables, timetables, structures, and cell arrays provide a way to store dissimilar types of data in the same container.