Switch between two inputs
Simulink / Signal Routing
The Manual Switch block is a toggle switch that selects one of its two inputs to pass through to the output. To toggle between inputs, double-click the block. You control the signal flow by setting the switch before you start the simulation or by changing the switch while the simulation is executing. The Manual Switch block retains its current state when you save the model.
To programmatically toggle the switch, set the set_param
sw
property to '0'
or '1'
. For
example, to connect the second input to the output:
set_param(gcb,'sw','0')
To connect the first input to the output:
set_param(gcb,'sw','1')
Note
Double-clicking the Manual Switch block does not open the block dialog box. Instead, it toggles the input choice.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Manual Variant Sink | Manual Variant Source | Multiport Switch | Switch