Documentation

isinf

Array elements that are infinite

Syntax

TF = isinf(A)

Description

TF = isinf(A)returns an array the same size asAcontaining logical 1 (true) where the elements ofAare+Infor-Infand logical 0 (false) where they are not. For a complex numberz,isinf(z)returns1if either the real or imaginary part ofzis infinite, and0if both the real and imaginary parts are finite orNaN.

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

Examples

collapse all

Determine the infinite elements of the row vector,A.

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

Extended Capabilities

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

See Also

||

Introduced before R2006a

Was this topic helpful?