Lock Links to Blocks in a Library
You can lock the links between a parent library block and its linked blocks. When you lock the links to a library, you can no longer edit or disable the links from a library block instance used in a model. This behavior prevents unintentional modifications and enhances the protection of your library blocks.
To lock the links between a parent library block and its linked blocks, go to the Library window. On the Library tab, click Lock Links and save the library. When you refresh the model you can see a change in the link badge. The locked link badges have a black background.
You can also lock the library links programmatically. For more information, see Lock Linked Blocks.
The context menu of a locked linked block displays Locked Library Link instead of Library Link, which is displayed for a linked block without locks. Go To Library Block is the only option enabled on this context menu.
If you open a locked linked block, the window title displays Locked Link:
blockname
. The bottom left corner shows a
lock icon and a link badge . You can also point to the link badge to view lock
information.
To unlock the links, go to the Library window. On the Library tab, click Links Locked and save the library. If the library itself is locked, the Links Locked button is disabled. You must first unlock the library to enable the option.
Rules for Locked Links
When you lock the links to a library:
You cannot edit a locked linked block in a model. If you try to make a structural change to a locked linked block, such as editing a diagram, Simulink® displays a message that you cannot modify the link because it is either locked or inside another locked link.
You cannot disable the link between a linked block in a model and its parent library block from the linked block. To disable these links, you must use the command line to set the
LinkStatus
parameter of the block toinactive
. For more information, see Control Linked Blocks Programmatically.The mask and block parameter dialog boxes are disabled for blocks inside locked links. For a resolved linked block with a mask, its parameter dialog box is always disabled.
You cannot parameterize locked links in the Model Editor.
When you copy a block, the current library status determines whether the link is locked. If you copy from a library with locked links, the copied link stays locked. If you unlock the library links later, existing linked blocks keep their locked status until you refresh the links.
If you use sublibraries, when you lock the links to a library, you must also lock the links to the sublibraries.