Manual Switch
R2026bSwitch between two inputs
Libraries:
Simulink /
Signal Routing
Description
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.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"simulink/Signal Routing/Manual Switch"
Example: add_block("simulink/Signal Routing/Manual Switch","myModel/myBlock",MakeNameUnique="on")
For information about programmatic access to individual block parameters, see the Programmatic Use section of parameter descriptions on this page.
Extended Capabilities
Version History
Introduced before R2006a
See Also
Switch | Multiport Switch | Manual Variant Source | Manual Variant Sink

