Simulink.SubSystem.convertToModelReference
Convert subsystem to model reference
Syntax
Description
Simulink.SubSystem.convertToModelReference(gcb,'UseConversionAdvisor',true)
opens the Model Reference Conversion Advisor for the
selected Subsystem block.
[
converts the specified subsystems to referenced models.tf
,h
]
= Simulink.SubSystem.convertToModelReference(subsys
,model
)
For each subsystem that the function converts, it:
Creates a model.
Copies the contents of the subsystem into the new model.
Updates any root-level input and output blocks and the configuration parameters of the model to match the compiled attributes of the original subsystem.
Copies the contents of the model workspace of the original model to the new model.
Before you use this function, load the model containing the subsystem.
Examples
Input Arguments
Output Arguments
Tips
You cannot convert a parent subsystem and a child of that subsystem at the same time.
Specifying multiple subsystems to convert with one command can save time compared to converting each subsystem separately. The multiple subsystem conversion process compiles the model once.
If you specify multiple subsystems to convert, the conversion process attempts to convert each subsystem. Successfully converted subsystems produce referenced models, even if the conversions of other subsystems fail.
If you specify multiple subsystems, consider:
In the input arguments, setting
'Autofix'
,'ReplaceSubsystem'
, and'CheckSimulationResults'
totrue
.In the model, setting a short simulation time.
A data dictionary saves bus objects that it creates as part of the conversion process when both of these conditions exist:
The top model uses a data dictionary.
All changes to the top model are saved.
To maintain the behavior of a masked subsystem, perform these additional tasks:
For masked callbacks, icons, ports, and documentation, create a backup copy of the masked subsystem before converting it to a referenced model. After conversion, copy the content from the Mask Editor of the backup masked subsystem to the Mask Editor of the new Model block.
Replace mask parameters with model arguments (see Parameterize Instances of a Reusable Referenced Model).
Note
Referenced models do not support the functionality that you can achieve with mask initialization code to create masked parameters.