The SWITCH function compares the value input with the values at the caseX inputs. If value matches caseK, the value from the x input is passed to the yK output. If there are multiple matches, the first one is selected.
The values at the outputs are retained until the reset input receives a true signal.
In the function menu | On the diagram |
---|---|
![]() |
![]() |
Name | Value Type | Description |
---|---|---|
x |
float int32 bool |
The value to be passed to one of the y outputs. |
reset |
bool |
If set to true, all yN outputs are set to 0, and the k output is set to -1. |
case0 |
float int32 bool |
The first value to compare with the value input. |
... | ... | ... |
caseN-1 |
float int32 bool |
The (N-1)th value to compare with the value input. N – number of input lines, configured via the "Number of Inputs" setting |
Name | Value Type | Description |
---|---|---|
k |
int32 |
The index of the output to which the x input value is passed. |
y0 |
see note | Receives the x input value if value matches case0. |
... | ... | ... |
yN-1 |
see note | Receives the x input value if value matches caseN-1. N – number of output lines, configured via the "Number of Outputs" setting |
The output value type matches the type of the x input value.
Name | Description |
---|---|
Number of Inputs | This setting determines the number of case input lines. |
Number of Outputs | This setting determines the number of y output lines. This setting is locked and synchronized with the Number of Inputs setting. |
Input Data | |
---|---|
x | 1000 |
reset | false |
value | 2 |
case0 | 1 |
case1 | 2 |
case2 | 3 |
case3 | 4 |
With this input data, where value = case1, the value from x is passed to the y1 output.
Now change the values at x and value inputs to 2500 and 4, respectively. Now value = case3, so the value from x is passed to y3. The value previously passed to y1 remains unchanged.