FixPt Multiport Switch
Switch output between different inputs based on the value of the first input.
Description
The FixPt Multiport Switch block is a masked S-function that passes through the data input specified by the first (top) input. The first input is called the control input, while the rest of the inputs are called data inputs. The output data type is determined by the data input with the largest positive range.
Dialog Box Parameters

- Number of input ports - The number of data inputs to the block. The inputs can be scalar or vector.
- Output data type and scaling - Inherit the output data type and scaling from the driving block or by back propagation.
- Round toward - Rounding mode for the fixed-point output. This parameter does not apply to an integer control input.
- Saturate to max or min when overflows occur - If checked, fixed-point overflows saturate. Otherwise, they wrap. This parameter does not apply to an integer control input.
- Log minimums and maximums - If checked, minimum and maximum simulation values are logged to the workspace.
Inputs and Outputs
If the control input is an integer value, then the specified data input is passed through to the output. For example, if the control input is 1, then the first data input is passed through to the output. If the control input is not an integer value, the block 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.
The block output is determined by these rules:
- If you specify only one data input and that input is a vector, the block behaves as an "index selector," and not as a multi-port switch. The block output is the vector element that corresponds to the value of the control input.
- If you specify multiple data inputs, the block behaves like a multi-port switch. The output is the data input that corresponds to the value of the control input. If at least one of the data inputs is a vector, the output is a vector. Any scalar inputs are expanded to vectors.
- If the inputs are scalar, the output is a scalar.
Characteristics
| Characteristic | Description |
|---|---|
| Input Port | Any data type supported by the blockset |
| Output Port | Any data type supported by the blockset |
| Direct Feedthrough | Yes |
| Sample Time | Inherited |
| Scalar Expansion | Yes |
| States | 0 |
| Vectorized | Yes |