Main Content

Disable or Break Links to Library Blocks

Structural changes in a model include addition or deletion of blocks or adding ports while non-structural changes include changes in parameter value.

A linked block does not allow structural changes to it. You can disable the link of a linked block from its parent library block and perform required modifications. A disabled linked block behaves like a local instance of a block and allows you to make structural and nonstructural changes.

To disable a link, right-click the linked block and select Library Link > Disable Link. The Disable Link menu choice is made available only if the parent block of the linked block is disabled. If the menu option is grayed out, you must disable the link of the parent block first.

Alternatively, you can right-click the link icon in the graph on the bottom left corner of the canvas and click Disable Link. This action recursively disables the links of all the blocks up in the hierarchy.

To prevent unintentional disabling of a linked block, you can lock its links to the library. To lock a link, in the Library window, on the Library tab, click Lock Links. You can later choose to unlock the locked link by clicking Links Locked.

Note

Simulink® offers to disable the library links (unless the link is locked) when you try to make structural changes to a block that contains active library links.

Do not use set_param to make structural changes to an active link. The result of this type of change is undefined.

A disabled link of a linked block can be restored. For more information, see Restore Disabled Links.

Disabled links can cause merge conflicts and failure to update all instances of the same model component. In a hierarchy of links, you can accidentally disable all links without being aware of it, and only restore one link while leaving others disabled.

Break Links

You can permanently break links to the parent library. Before you break a library link, the link must first be disabled. When you break a link, the linked block is converted to a standalone block, and you cannot detect what the block linked to previously.

To break a link, use any of these options:

  • For disabled links, right-click the linked block and select Library Link > Break Link.

  • To copy and break links to multiple blocks simultaneously, select multiple blocks and then drag. The locked links are ignored and not broken.

  • When you save the model, you can break links by supplying arguments to the save_system command. For more information, see save_system.

Note

  • Some models can contain blocks from third-party libraries or optional Simulink block sets. Breaking the link for such models does not guarantee that you can run the model standalone. It is possible that a library block invokes functions supplied with the library and hence can run only if the library is installed on the system running the model.

  • Breaking a link can cause a model to fail when you install a new version of the library on a system. For example, if a model block invokes a function that is supplied from a library. If you break the link for such a block, the function can no longer be invoked from the model, causing simulation to fail. To avoid such problems, avoid breaking links to libraries.

See Also

|