libinfo command to get information about the linked
blocks in the model.
libinfo also provides information about
the parent library blocks of a linked block.
For example, here is a model with linked blocks:
When you execute the
libinfo(gcb) command on this
Block: 'slexMaskVariantExample/VariantSubsystem2' %Linked block Library: 'slexMaskingVariants_libraryblock' %Parent library block ReferenceBlock: 'slexMaskingVariants_libraryblock/VariantSubsystem2' LinkStatus: 'resolved' %Link status
ReferenceBlock property gives the path of the library
block to which a block links. You can change this path programmatically by using the
set_param command. For example:
set_param('slexMaskVariantExample/VariantSubsystem2', 'ReferenceBlock', 'slexMaskVariantExample2/VariantSubsystem')
slexMaskVariantExample/VariantSubsystem2 is the original
library block path and
is the new library block path.
It is not recommended to change the properties of a referenced block by using
set_param command in the mask initialization code or
callback code of the same block. For such modeling patterns, you can use Variant
blocks (Masking variant blocks) or use the
parameter on the callback code or the mask initialization code of the parent
block of the reference block.
LockLinksToLibrary command to lock or unlock a linked
block in a library from the command line. When you set the value of
on, the linked block
links to the library are locked.
set_param('MyLibraryName', 'LockLinksToLibrary', 'on') %Lock links
set_param('MyLibraryName', 'LockLinksToLibrary', 'off') %Unlock links
All blocks have a
LinkStatus parameter and a
StaticLinkStatus parameter to indicate whether the block is a
get_param(gcb, 'StaticLinkStatus') to query the link status
without updating the linked blocks. You can use
to query the status of a linked block that is either active or outdated.
get_param to send a query to get the value of the
|Get LinkStatus Value||Description|
Block is not a linked block.
Block resides in library block and is itself not a link to
a library block. Suppose that A is a link to a subsystem in a
library that contains the Gain block. If you open
A and select the Gain block,
set_param to set the
|Set LinkStatus Value||Description|
Breaks link. Use
Breaks links in place without breaking the nested parent
hierarchy of link. For example,
Disables link. Use
Restores an inactive or disabled link to a library block
and discards any changes made to the local copy of the library
block. For example,
Pushes any changes made to the disabled link to the library
block and re-establishes its link.
Restores all disabled links in the hierarchy with their
corresponding library blocks.
Pushes all links with changes in the hierarchy to their
When you use
get_param to query the link
status of a block, the outdated block links also resolve.
StaticLinkStatus command to query the
link status when
get_param is being used in the
callback code of a child block is recommended.
StaticLinkStatus command does not resolve any
If you call
get_param on a block inside a library link,
Simulink® resolves the link wherever necessary. Executing
get_param can involve loading part of the library and