Main Content

Identifying Numeric Classes

You can check the data type of a variablexusing any of these commands.

Command

Operation

whos x

Display the data type ofx.

xType = class(x);

Assign the data type ofxto a variable.

isnumeric(x)

Determine ifxis a numeric type.

isa(x, 'integer')
isa(x, 'uint64')
isa(x, 'float')
isa(x, 'double')
isa(x, 'single')

Determine ifxis the specified numeric type. (Examples for any integer, unsigned 64-bit integer, any floating point, double precision, and single precision are shown here).

isreal(x)

Determine ifxis real or complex.

isnan(x)

Determine ifxis Not a Number (NaN).

isinf(x)

Determine ifxis infinite.

isfinite(x)

Determine ifxis finite.