Jump to content

User Reference:ExpressionFilter

From BCI2000 Wiki
Revision as of 13:54, 5 November 2007 by Mellinger (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Function

The ExpressionFilter uses Arithmetic Expressions to determine its output. Additionally, a warning message may be sent to the operator module.

A tutorial filter demonstrating // the use of boolean and arithmetic expressions in parameters. // -- Each time the WarningExpression expression evaluates to true, // a warning is issued. // -- Filter output is determined by the expressions given in the // Expressions matrix.


Parameters

WarningExpression

A boolean expression. Whenever this expression evaluates to true, a warning message is displayed in the operator module's log window. Set this parameter to the empty string to disable the warning message.

Expressions

A matrix that determines the filter's output signal; output signal dimensions are derived from matrix dimensions: Matrix rows correspond to signal channels, and matrix columns correspond to signal elements (samples). For each signal block, each of the expressions is evaluated, and the result is entered into the corresponding element in the output signal. Expressions may contain references to the filter's input signal, and to state variables (see examples).

States

Any available state may enter into one of the expressions.

Example

The following 2-by-2 matrix will replace a 2-by-2 input signal with its square. Additionally, when the ResultCode state variable is nonzero, the output will be zero.

Signal(0,0)^2*(ResultCode==0)   Signal(0,1)^2*(ResultCode==0)
Signal(1,0)^2*(ResultCode==0)   Signal(1,1)^2*(ResultCode==0)