The three approaches that you can use to correct bus signals used as vectors (muxes) to avoid an error are:
Generally, using the Model Advisor is the most efficient approach.
In the Simulink® Editor, select Analysis > Model Advisor > Model Advisor.
Select and run the Simulink Check bus signals treated as vectors check.
The Model Advisor reports any cases of bus signals treated as vectors.
Follow the Model Advisor suggestions for correcting errors reported by the check.
For additional information about using the Model Advisor, see Select and Run Model Advisor Checks.
You can explicitly add Bus to Vector blocks to convert the bus signal to a mux (vector), using one of these approaches:
To convert the bus to a vector explicitly, insert the Bus to Vector block into any bus used implicitly as a vector.
which automatically inserts Bus to Vector blocks wherever
For example, this model treats a bus signal as a vector signal by using the bus as an input to a Gain block. The Scope block shows the simulation results.
This figure shows the same model, rebuilt after inserting a Bus to Vector block after the Bus Creator block.
The results of simulation are the same in either case, but adding the Bus to Vector block avoids an error. The Bus to Vector block is virtual, and does not affect simulation results, code generation, or performance.
You can replace blocks manually. Change the sources for a block that require vector inputs to avoid feeding a bus signal into a block that requires vector input.
For example, in the following model, the Gain block requires a vector signal. However, the input signal is a bus signal created by a Bus Creator block.
To provide the required vector signal for the Gain block, change the Bus Creator block to a Mux block.
Challenges with reorganizing the model manually include:
It can be difficult to identify all the occurrences in a model. (The Model Advisor check identifies all occurrences in the model and helps you to correct them.)
Dealing with many occurrences in a model is time-consuming and error-prone.
Reorganizing the model to address this issue can interfere with other aspects of the model.
If you use Save As for a model in a version of the Simulink product before R2007a, Simulink replaces each Bus to Vector block with a null subsystem that outputs nothing. Before you can use the model, reconnect or otherwise correct each signal that used to contain a Bus to Vector block but now is interrupted by a null subsystem.