| Simulink Reference | ![]() |
Choose between multiple block inputs
Library
Description
The Multiport Switch block chooses between a number of inputs. The first (top) input is called the control input, while the rest of the inputs are called data inputs. The value of the control input determines which data input is passed through to the output port.
If the control input is an integer value, then the specified data input is passed through to the output. For example, suppose the Use zero-based indexing parameter is not selected. If the control input is 1, then the first data input is passed through to the output. If the control input is 2, then the second data input is passed through to the output, and so on. If the control input is not an integer value, the block first truncates the value to an integer by rounding to floor. If the truncated control input is less than 1 or greater than the number of input ports, an out-of-bounds error is returned.
You specify the number of data inputs with the Number of input ports parameter. The data inputs can be scalar or vector. The block output is determined by these rules:
The Index Vector block, also in the Signal Routing library, is another implementation of the Multiport Switch block that has different default parameter settings.
Data type support
The control and data inputs of a Multiport Switch block can be signals of any data type supported by Simulink, except Boolean. The Multiport Switch block supports fixed-point data types.
The control inputs must be real. The data inputs can be real or complex.
For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.
Parameters and Dialog Box
The Main pane of the Multiport Switch block dialog appears as follows:
-1. See Specifying Sample Time in the online documentation for more information.
The Signal data types pane of the Multiport Switch block dialog appears as follows:
Characteristics
| Direct Feedthrough |
Yes |
| Sample Time |
Specified in the Sample time parameter |
| Scalar Expansion |
Yes |
| Dimensionalized |
Yes |
| Zero Crossing |
No |
| Model Info | Mux | ![]() |
© 1994-2005 The MathWorks, Inc.