Convert Subsystem, Model, or Variant Model block to Variant Subsystem block
This method requires Variant Manager for Simulink®.
Future releases will no longer support using a Model block to
contain model variants. You can use the
to convert model variants so that Model blocks are contained in a
Variant Subsystem. Use of a Variant Subsystem
block provides these advantages:
Allows you to mix Model and Subsystem blocks as variant choices
Supports flexible I/O, so that all variants do not need to have the same number of input and output ports
For an example of a model that uses a Variant Subsystem block as a container for variant models, see Model Reference Variants.
blockPathOrHandle — Subsystem or Model block to convert
block path | block handle
The Subsystem or Model block to convert to a Variant Subsystem block, specified as a block path or handle. Specify a block path as a character vector and a block handle as a scalar.
variant_subsystem — Handle of Variant Subsystem block
The block handle of the Variant Subsystem block created by the conversion, returned as a scalar.
Convert Subsystem block or Model block to Variant Subsystem
Consider this model with a Subsystem block.
You can convert this Subsystem block to a Variant
Subsystem block using the
Similarly you can convert a Variant Model block to a Variant Subsystem block.
If there are inconsistencies in the port name or port number in models referenced by Variant Model block, Simulink corrects these inconsistencies while converting the Variant Model block to a Variant Subsystem block.
Consider this model with a Variant Model block having different port names.
When you convert this Variant Model block to a Variant Subsystem block, the inconsistencies are corrected automatically.
convertToVariant method does not support these scenarios:
The Subsystem block is in a Simscape™ model that has Editing Mode set to Restricted.
The Variant Model block has a mix of control ports or there is a name mismatch in control port types.
The Variant Model block has control ports with different port numbers and name mapping.
In the Simulink Editor, right-click the Model block and select Subsystems & Model Reference > Convert to > Variant Subsystem.
Upgrade Advisor Check
To convert a Variant Model block to a Variant Subsystem block, you can use the Upgrade Advisor check Identify Variant Model blocks and convert those to Variant Subsystem containing Model block choices. This check provides a Fix button to convert Variant Model blocks to Variant Subsystem blocks. For more information on using Upgrade Advisor check to convert a Variant Model block to a Variant Subsystem block, see Upgrade Advisor Checks.
Introduced in R2017b