Documentation

isfinite

Array elements that are finite

Syntax

TF = isfinite(A)

Description

TF = isfinite(A)returns an array the same size asAcontaining logical 1 (true) where the elements of the arrayAare finite and logical 0 (false) where they are infinite orNaN. For a complex numberz,isfinite (z)returns1if both the real and imaginary parts ofzare finite, and0if either the real or the imaginary part is infinite orNaN.

For any realA, exactly one of the three quantitiesisfinite(A),isinf(A), andisnan(A)is equal to one.

Examples

collapse all

Create a row vector,A, and determine the finite elements.

A = 1./[-2 -1 0 1 2]
A =-0.5000 -1.0000 Inf 1.0000 0.5000
TF = isfinite(A)
TF =1×5 logical array1 1 0 1 1

Extended Capabilities

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

See Also

||

Introduced before R2006a

Was this topic helpful?