User Reference:ExpressionFilter
Function
The ExpressionFilter uses Arithmetic Expressions to determine its output. Additionally, a warning message may be sent to the operator module, depending on an expression's value.
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.
Examples
When the JoystickFilter is used to track a joystick position, the JoystickXpos and JoystickYpos state variables represent joystick position. When the ExpressionFilter is present at the last position in the signal processing module, it may be configured to control the cursor directly by joystick position, using this 1-by-2 matrix:
JoystickXpos JoystickYpos
In the same configuration, to re-enable cursor movement by the output of signal processing without removing the ExpressionFilter from the signal processing module, use this configuration:
Signal(0,0) Signal(0,1)
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)