Main Content

isfloat

R2026b

Determine if input is floating-point array

Description

tf = isfloat(A) returns true if A is a floating-point array and false otherwise. Floating-point types in MATLAB® include single and double (and subclasses of single and double).

example

Examples

collapse all

Determine if the following numbers are a floating-point type.

The real number pi in double precision is a floating-point type.

tf = isfloat(pi)
tf = logical
   1

Complex numbers in double precision are a floating-point type.

tf = isfloat(3+7i)
tf = logical
   1

Single-precision numbers are a floating-point type.

tf = isfloat(realmax("single"))
tf = logical
   1

A logical value is not a floating-point type.

tf = isfloat(true)
tf = logical
   0

Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array. Floating-point types in MATLAB include single and double (and subclasses of single and double).

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced before R2006a