View Raw SPL
/****************************************************************************
* *
* DELMATCH.SPL Copyright 2008 (C) DSP Development Corporation *
* *
* Author: Randy Race *
* *
* Synopsis: Removes source series values found in a target series *
* *
* Revisions: 25 Jul 2008 RRR Creation *
* *
****************************************************************************/
#if @HELP_DELMATCH
DELMATCH
Purpose: Removes values from a source series found in a target series.
Syntax: DELMATCH(source, target)
source - A series, the series to process.
target - A series, the values to be removed.
Returns: A series.
Example:
W1: {1, 2, 3, 4, 2, 3, 1}
W2: {2, 3}
W3: delmatch(w1, w2)
W3 == {1, 4, 1}
The values 2 and 3 are removed from the input series.
Remarks:
DELMATCH only operates on real series and tables.
DELMATCH uses the SERMATCH DLL - sermatch.dll.
See Also:
Conditional Operators
Find
Remove
Sermatch
#endif
/* delete from s any values found in target */
ITERATE delmatch(source, target)
{
if (argc < 2) error("delmatch - input series and target series required");
/* find indices of all matches */
idx = sermatch(source, target);
if (length(idx) > 0)
{
source = remove(source, idx);
}
return(source);
}