Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

slreplace_mux

In legacy models, replace with Bus Creator blocks Mux blocks used to create buses

Syntax

[muxes,uniqueMuxes,uniqueBds] = slreplace_mux(model)
[muxes,uniqueMuxes,uniqueBds] = slreplace_mux(model,reportOnly)

Description

[muxes,uniqueMuxes,uniqueBds] = slreplace_mux(model) reports all Mux blocks that create buses in model and in libraries referenced by model. A signal that is created by a Mux block and meets either or both of these conditions is a bus:

  • A Bus Selector block individually selects one or more of the signal elements (as opposed to the entire signal).

  • The signal components have different data types, numeric types (complex or real), dimensionality, storage classes, or sampling modes.

example

[muxes,uniqueMuxes,uniqueBds] = slreplace_mux(model,reportOnly) if reportOnly is set to false, reports all Mux blocks that create buses in model and in libraries referenced by model and replaces all such Mux blocks with Bus Creator blocks. The function saves the model, if changed, and saves and closes any changed library. If reportOnly is set to true, the function does not update the model.

    Note:   Before using this function with reportOnly set to false, make a backup copy of your model and libraries.

Examples

collapse all

One way that a model created before R2013b can mix bus and mux signals is when a Mux block creates a virtual bus. Mixing bus and mux signals in a model causes your model to be less robust. You can use the slreplace_mux function to replace a Mux block that creates a bus signal.

Open a model called mux_to_bus_selector that uses a Mux block signal as input to a Bus Selector block.

Replace the Mux block with a Bus Creator block.

[muxes,uniqueMuxes,uniqueBds] = slreplace_mux(mux_to_bus_selector,false);
sim('mux_to_bus_selector')

Input Arguments

collapse all

Model to report on and optionally update, specified as a character vector.

Example:

Report results but do not change model, specified as false or true.

  • false — Update the model by converting Mux blocks that create buses to Bus Creator blocks.

  • true — Report search results, but do not change the model.

Example:

Data Types: logical

Output Arguments

collapse all

All Mux blocks used as Bus Creator blocks in the model and in libraries referenced by the model, returned as an array.

All Mux blocks used as Bus Creator blocks, except copies of library blocks, returned as an array.

All models and libraries that use Mux blocks as Bus Creator blocks, returned as an array.

Tips

You can continue to run an existing script that uses the slreplace_mux function to replace with Bus Creator blocks any Mux blocks used to create buses. However, in a future release, the slreplace_mux function might be removed.

For releases starting in R2017a, to handle a legacy model that contains mux and bus mixtures:

  1. In a release before R2017a, run the Upgrade Advisor with the Check Mux blocks that create bus signals check enabled.

  2. In R2017a or a later release, open the upgraded model.

See Also

|

Topics

Introduced before R2006a

Was this topic helpful?