NANFINDER Procedure

Finds all instances of nan, inf, -inf in an array.

Usage

NANFINDER, a, i, j, k

Input Parameters

a—A numerical array.

Output Parameters

i—The array of indices locating the nan's.

j—The array of indices locating the inf's.

k—The array of indices locating the -inf's.

The scalar -1 is returned if an array has no elements.

Keywords

b—(output) A copy of the input array, but where each symbolic value is replaced with its nearest neighboring numeric value.

Example

f = MACHINE(/float)                 &  a = FINDGEN(5,6)
m = BYTSCL( RANDOMU(s,6), top=29 )  &  a(m(0)) = f.nan
a(m(1:2)) = f.pos_inf               &  a(m(3:*)) = f.neg_inf
NANFINDER, a, i, j, k, b=b          &  PM, a, ' '
PM, i, ' '                          &  PM, j, ' '
PM, k, ' '                          &  PM, b