Update Model blocks to reflect changes to referenced models
Simulink.ModelReference.refresh(modelBlock)
example
Simulink.ModelReference.refresh(modelBlock) updates the specified Model block to reflect changes to the referenced model.
modelBlock
collapse all
This example shows what happens when you refresh a Model block after adding a port to the referenced model.
Open the top model and load the referenced model.
open_system('RefreshModelBlockModel'); load_system('RefreshModelBlockMdlRef');
Add an input port to the referenced model. Because the referenced model already has a block named Inport, use the MakeNameUnique option to ensure that the new block name is unique.
MakeNameUnique
add_block('simulink/Ports & Subsystems/In1',... 'RefreshModelBlockMdlRef/Inport','MakeNameUnique','on');
Refresh one of the Model blocks.
Simulink.ModelReference.refresh('RefreshModelBlockModel/Model');
The refreshed Model block shows the port you added, while the other Model block does not.
Model block to refresh, specified as a character vector or a handle.
Example: 'RefreshModelBlockModel/Model'
'RefreshModelBlockModel/Model'
Data Types: char | string | double
char
string
double
Model block version mismatch | Port and parameter mismatch
You have a modified version of this example. Do you want to open this example with your edits?