Simulink.ModelReference.refresh

Update Model blocks to reflect changes to referenced models

Description

example

Simulink.ModelReference.refresh(modelBlock) updates the specified Model block to reflect changes to the referenced model.

Examples

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.

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.

Input Arguments

collapse all

Model block to refresh, specified as a character vector or a handle.

Example: 'RefreshModelBlockModel/Model'

Data Types: char | string | double

Introduced in R2020a