View Raw SPL
/*****************************************************************************
* *
* REMOVENA.SPL Copyright (C) 1998-2000 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Matthew Tom *
* *
* Synopsis: Remove NAVALUE's from a series *
* *
* Revisions: 3 Jul 1997 MAT Creation *
* 21 Aug 1998 MAT Help Menu Entry *
* 18 Apr 2000 RRR use delete and isnavalue *
* *
*****************************************************************************/
#include
#if @HELP_REMOVENA
REMOVENA
Purpose: Removes the NAVALUES from a series or array.
Syntax: REMOVENA(s)
s - input series or array
Returns: A series or array with all of the NAVALUE's removed.
Examples:
W1: {5, NAVALUE, NAVALUE, 1}
W2: removena(w1)
W2 == {5.0, 1.0}
See Also:
Delete
Find
Isnavalue
#endif
/* remove NaN from series or array */
removena(s)
{
/* convert to series if required */
if (not(isarray(s)))
{
s = castseries(s);
}
if (anynan(s))
{
/* have at least one NaN */
return(delete(s, isnavalue(s)));
}
else
{
/* no nan */
return(s);
}
}