finite

Purpose

Detect infinities.

Synopsis

Y = finite(X)

Description

Y = finite(X) returns 1s where the elements of X are finite and 0s where they are infinite or NaN. X can be a vector or a matrix.

For any x, exactly one of the three quantities finite(x), isinf(x), and isnan(x) is equal to one.

Examples

Let

x = [-2  -1  0  1  2]
Then

finite(1./x) =  [1  1  0  1  1]
isinf(1./x)  =  [0  0  1  0  0]
isnan(1./x)  =  [0  0  0  0  0]
and

finite(0./x) =  [1  1  0  1  1]
isinf(0./x)  =  [0  0  0  0  0]
isnan(0./x)  =  [0  0  1  0  0]

See Also

all, any, find, isempty, isinf, isnan

(c) Copyright 1994 by The MathWorks, Inc.