isbad

Determine whether array is "bad"

Syntax

   b = isbad(x)

Arguments

input

   x                 an array
   demand_allfinite  true (default) if "bad" means at least one NaN or Inf

output

   b                 logical scalar

Description

Simple routine that returns true/false according as to whether the input x is "bad", meaning (i) if demand_allfinite flag set (default) it contains at least one NaN or Inf or (ii) if demand_allfinite flag unset it contains all NaN s or Inf s. This is useful to check results of calculations that result in NaN s or Inf s when they shouldn't (in particular tsdata_to_var).

See also

tsdata_to_var | isfinite