Simulink Reference | ![]() ![]() |
Combine several input signals into a vector or bus output signal
Library
Description
The Mux block combines its inputs into a single output. An input can be a scalar, vector, or matrix signal. Depending on its inputs, the output of a Mux block is a vector or a composite signal, i.e., a signal containing both matrix and vector elements. If all of a Mux block's inputs are vectors or vector-like, the block's output is a vector. A vector-like signal is any signal that is a scalar (one-element vector), a vector, or a single-column or single-row matrix. If any input is a non-vector-like matrix signal, the output of the Mux block is a bus signal. Bus signals can drive only virtual blocks, e.g., Demux, Subsystem, or Goto blocks.
The Mux block's Number of Inputs parameter allows you to specify input signal names and dimensionality as well as the number of inputs. You can use any of the following formats to specify this parameter:
signalN
, where N
is the input port number.
[2 3]
specifies two input ports of sizes 2
and 3
, respectively. If an input signal width does not match the expected width, Simulink displays an error message. A value of -1
specifies that the corresponding port can accept vectors or matrices of any dimensionality.
N
specifies a vector of size N
. A vector value [M N]
specifies an M-by-N
matrix. A value of -1
means that the corresponding port can accept signals of any dimensionality.
position,velocity
, the Mux block will have two inputs, named position
and velocity
.
Note Simulink hides the name of a Mux block when you copy it from the Simulink block library to a model. |
Data Type Support
A Mux block accepts real or complex signals of any data type, including fixed-point data types, except int64
and uint64
. The Mux block supports mixed-type vectors.
Parameters and Dialog Box
Display Option |
Appearance of Block in Model |
none |
Mux appears inside block icon |
signals |
Displays signal names next to each port |
bar |
Displays the block icon in a solid foreground color |
![]() | Multi-Port Switch | Outport | ![]() |