A linked block is a referenced instance of a library block. A linked block contains a link (or path) to the corresponding library block. The link allows the block to update when the corresponding library block is updated.
You create a linked block by adding a library block with any of these conditions to a Simulink® model:
The reference library block is masked.
The referenced library block is an unmasked Subsystem block that contains child blocks within itself.
To create a linked block, you can use the library blocks available in the Simulink Library Browser or from a user-defined library.
To locate the parent library block of a linked block, right-click the linked block and select Library Link > Go To Library Link.
When you edit a library block (either in Simulink Editor or at the command line), the outdated links on the linked blocks are grayed out. Simulink refreshes or updates any outdated links to edited blocks when you activate the Simulink Editor windows, even if you do not save the library.
Simulink updates the outdated linked blocks in a model or library when you:
Load the model or library.
Simulate or update the model.
get_param to query the link
status of the block (see Control Linked Block Programmatically).
To update the links manually, you can use these commands:
Simulation > Update Diagram (or press Ctrl+D)
Diagram > Refresh Blocks (or press Ctrl+K)
You can change the values of a linked block parameter (including the existing mask).
Note: The Allow library block to modify its contents check box in the Initialization pane of the library block must be selected.
You cannot set callback parameters for a linked block.
If the reference library block of a linked block is a subsystem, you can make nonstructural changes such as changing the parameter value of the linked subsystem. To make structural changes to a linked block, disable the link of the linked block from its library block (See Disable or Break Links to Library Blocks).
A parameterized link is created when you change the parameter values of the child blocks of a masked subsystem linked block. Such parameter value changes can only be applied through the MATLAB® command prompt.
A parameterized link in a linked block allows you to have a parameter value that is different from the parent library block and yet retain the links to its parent library block.
Note: Changing the mask value of a parent library block does not create a parameterized link.
For example, you can use the
to set a parameter value in the child blocks of a linked subsystem
set_param command overrides the parameter
values of the child blocks of the subsystem linked block differentiating
it from its parent library block and thus creating a parameterized
Consider a masked subsystem linked block (see, Simple Linked Block) that contains
a Gain block with its parameter value as
Simple Linked Block
To change the Gain parameter value of this block to
set_param(ModelName, 'Gain', '100') at the MATLAB command
prompt. A parameterized link is now created, overriding the parameter
value (see, Parameterized Linked Block).
Parameterized Linked Block
When you save a model containing a parameterized link, Simulink saves the changes to a local copy of the subsystem with the path to the parent library. When you reopen the model, Simulink copies the library block into the loaded model and applies the saved changes.
Note: To view the parameterized changes on a block, right-click the block, and on the context menu, select View Changes. The Link changes dialog box opens displaying the list of modified blocks. You can also use this dialog box to remove parameterized changes from a block.
A parameterized link displays these identifications:
The link badge of a parameterized link contains a black links with a red star icon, . For more information, Display Library Links.
The tooltip of a parameterized linked block displays
parameter in link.
Block dialog box of a linked Subsystem block contains
Tip We recommend using variant blocks over self-modifiable linked subsystems.
A self-modifiable linked subsystem is a linked block with the ability to have structural changes in the subsystem without disabling the link. A self-modifiable linked subsystem when you use a library block containing a self-modifiable mask as a linked block.
Self-modifiable linked subsystem allows you to create masked subsystems that modify their structural contents based on mask parameter dialog box values. It uses the mask initialization code to change the structural contents.