isnumeric

Tests whether an array is numeric.

Category: Language Fundamentals > Data Types

Syntax

tf = isnumeric(A)

Returns true if A is of a numeric class: floating-point or integer.

Description

Numeric classes are double, single and the eight integer classes. Characters and logical values can take part in arithmetic but are not numeric, so isnumeric('a') and isnumeric(true) are false. Complex numbers are numeric.

Input arguments

A
Any value.

Output arguments

tf
Logical scalar.

Example

Numeric classes

isnumeric(3.5)
isnumeric(uint8(7))
isnumeric(2+3i)
isnumeric('a')
isnumeric(true)
Output
ans = logical
   1
ans = logical
   1
ans = logical
   1
ans = logical
   0
ans = logical
   0

See also

isfloat isinteger isreal ischar islogical