isfloat

Tests whether an array holds floating-point numbers.

Category: Language Fundamentals > Data Types

Syntax

tf = isfloat(A)

Returns true if A is of class double or single.

Description

Only double and single are floating-point types. Integer types, logical and char are not, even though they can be converted to floating point freely. Complex arrays of these two classes also count.

Input arguments

A
Any value.

Output arguments

tf
Logical scalar.

Example

Which classes are floating point

isfloat(1)
isfloat(single(2.5))
isfloat(int8(3))
isfloat('a')
Output
ans = logical
   1
ans = logical
   1
ans = logical
   0
ans = logical
   0

See also

isinteger isnumeric isreal double single