| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
[success,mdlRefBlkH]
= Simulink.SubSystem.convertToModelReference(subsys, mdlRef, 'opt1', 'val1',
... , 'optN', 'valN')
[success,mdlRefBlkH] = Simulink.SubSystem.convertToModelReference(subsys, mdlRef, 'opt1', 'val1', ... , 'optN', 'valN') converts an atomic subsystem or function call subsystem to a referenced model. The function creates a new model, copies the contents of the subsystem into the model, sets the new model's configuration parameters, and configures the model's root level Inport and Outport blocks. The function then replaces the subsystem block with a Model block that references the new model, or creates another, temporary model containing a Model block that references the new model, depending on the input option ReplaceSubsystem.
Converting a subsystem to a referenced model requires your model to have the following configuration parameter settings:
Configuration Parameters > Optimization > Inline parameters must be On.
Configuration Parameters > Diagnostics > Data Validity > Signal resolution must be Explicit only.
Configuration Parameters > Diagnostics > Connectivity > Mux blocks used to create bus signals must be Error.
You can use the following commands to set these parameters to the values required by this function:
set_param(mdlName, 'InlineParams', 'on'); set_param(mdlName, 'SignalResolutionControl', 'UseLocalSettings'); set_param(mdlName, 'StrictBusMsg', 'ErrorLevel1');
This function produces error or warning messages for models and subsystems that it cannot handle.
For some errors, a message box appears that gives you the choice of cancelling or continuing.
If continuing is impossible, Simulink cancels the conversion without offering a choice to continue.
Even if conversion is successful, you may still need to reconfigure the resulting model to meet your requirements.
In the new model, the Interpolate data parameter of each root input port is selected by default. You can clear the parameter wherever this default is not appropriate. See the Inport block documentation for information about Interpolate data.
subsys |
Full name or handle of the atomic subsystem block to be converted | ||||||||
mdlRef |
Name of the new model to which the subsystem is to be converted | ||||||||
opt1, val1, ... , optN, valN |
Zero or more pairs of options and values that control the conversion process. The options and values are:
|
success |
The value is true if the conversion completed successfully, and false otherwise. |
mdlRefBlkH |
Handle of the Model block that references the new model. |
Converting a Subsystem to a Referenced Model | Simulink.BlockDiagram.copyContentsToSubSystem | Simulink.Bus.save | Simulink.SubSystem.copyContentsToBlockDiagram
![]() | Simulink.ModelReference.protect | Simulink.SubSystem.copyContentsToBlockDiagram | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |