The three approaches that you can use to correct bus signals used as muxes are:
Generally, using the Model Advisor is the most efficient approach.
Before you use the Model Advisor to correct bus signals used as muxes, perform the steps described in Correct Mux Blocks That Create Bus Signals.
Open the Model Advisor from the Upgrade Advisor, or in the Simulink® Editor, select Analysis > Model Advisor > Model Advisor.
Select and run the Simulink > Check bus usage check.
The Model Advisor reports any cases of bus signals treated as muxes.
Follow the Model Advisor suggestions for correcting errors reported by the check.
For additional information about using the Model Advisor, see Consulting the Model Advisor.
You can explicitly add Bus to Vector blocks to convert the bus signal to a mux (vector), using one of these approaches:
To explicitly convert the bus to a mux (vector), insert the Bus to Vector block into any bus used implicitly as a mux.
which automatically inserts Bus to Vector blocks wherever
For example, this model uses a bus signal as a mux 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. The Bus to Vector block is virtual, and does not affect simulation results, code generation, or performance.
You can replace blocks manually to avoid using bus signals as muxes. 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.
Change the Bus Creator block to a Mux block to provide the required vector signal for the Gain block.
Challenges with reorganizing the model manually include:
Identifying 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 to save a model in a version of the Simulink product before R2007a (V6.6), Simulink:
error if its value is
Replaces each Bus to Vector block in the model with a null subsystem that outputs nothing.
The resulting model specifies strong type checking for Mux blocks used to create buses. Before you can use the model, reconnect or otherwise correct each signal that contained a Bus to Vector block but is now interrupted by a null subsystem.