Parameterized Links and Self-Modifiable Linked Subsystems
You can use the MATLAB® command prompt to change the value of a parameter in a linked block. Such parameter changes on the linked block result in parameterized links.
Similarly, you can also modify the structure of a linked Subsystem block without changing the parent library block. Such changes can be applied using the mask initialization code and is called self-modifiable linked subsystem.
A parameterized link is created when you change the parameter values of the child blocks of a masked subsystem linked block.
A parameterized link allows you to have a different parameter value for the linked block and the parent library block. For such library blocks, the link to the parent block is still retained.
Changing the mask value of a parent library block does not create a parameterized link.
For example, you can use the
set_param command to set a
parameter value in the child blocks of a linked subsystem block. The
set_param command overrides the parameter values of the child
blocks of the subsystem linked block. Thus, differentiating the child block value
from its parent library block and creating a parameterized link.
Consider a Subsystem library block (see Subsystem Library Block) that contains a Gain block
within with its parameter value as
Subsystem Library Block
Use this Subsystem block as a linked block in a model.
You can modify the parameter values of the child blocks of the linked block
without changing the value of the parent library block. For example, you can change
the parameter value of the Gain block within the
Subsystem linked block.
To change the
Gain parameter value of the Gain
block within the
Subsystem linked block to
100, sequentially type these commands at MATLAB command prompt:
pathName = [ModelName,'/Gain_Subsystem1/Gain']; set_param(pathName, 'Gain', '100')
A parameterized link is now created, overriding the parameter value (see Parameterized Linked Block). Similarly, change the
Gain parameter value of the
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.
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.
Identifying Parameterized Links
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, see Display Library Links.
The tooltip of a parameterized linked block displays Modified parameter in link.
Block dialog box of a linked Subsystem block contains parameterized link.
Self-Modifiable Linked Subsystems
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 is created when you use a library block containing a self-modifiable mask as a linked block. You can use the mask initialization code to change the structural contents.
For more information, see Dynamic Masked Subsystem and Self-Modifiable Mask.