Combine multiple signals into single signal
Simulink / Commonly Used Blocks
Simulink / Signal Routing
HDL Coder / Commonly Used Blocks
HDL Coder / Signal Routing
The Switch block passes through the first input or the third input signal based on the value of the second input. The first and third inputs are data input. The second input is a control input. Specify the condition under which the block passes the first input by using the Criteria for passing first input and Threshold parameters.
The Switch block is a bus-capable block. The data inputs can be virtual or nonvirtual bus signals subject to the following restrictions:
All the buses must be equivalent (same hierarchy with identical names and attributes for all elements).
All signals in a nonvirtual bus input to a Switch block must have the same sample time. The requirement holds even if the elements of the associated bus object specify inherited sample times.
You can use a Rate Transition block to change the sample time of an individual signal, or of all signals in a bus. See Modify Sample Times for Nonvirtual Buses and Bus-Capable Blocks for more information.
You can use an array of buses as an input signal to a Switch block. For details about defining and using an array of buses, see Combine Buses into an Array of Buses. When using an array of buses, set the Threshold parameter to a scalar value.
If the data inputs to the Switch block are buses, the element
names of both buses must be the same. Using the same element names ensures that
the output bus has the same element names no matter which input bus the block
selects. To ensure that your model meets this requirement, use a bus object to
define the buses and set the Element name mismatch
diagnostic to error
. See Connectivity Diagnostics Overview for more information.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|