Using Simulink    

Creating a Library Link

To create a link to a library block in a model, copy the block's icon from the library to the model (see Copying and Moving Blocks from One Window to Another) or by dragging the block from the Library Browser (see Browsing Block Libraries) into the model window.

When you copy a library block into a model or another library, Simulink creates a link to the library block. The reference block is a copy of the library block. You can change the values of the reference block's parameters but you cannot mask the block or, if it is masked, edit the mask. Also, you cannot set callback parameters for a reference block. If the link is to a subsystem, you can modify the contents of the reference subsystem (see Modifying a Linked Subsystem).

The library and reference blocks are linked by name; that is, the reference block is linked to the specific block and library whose names are in effect at the time the copy is made.

If Simulink is unable to find either the library block or the source library on your MATLAB path when it attempts to update the reference block, the link becomes unresolved. Simulink issues an error message and displays these blocks using red dashed lines. The error message is

The unresolved reference block is displayed like this (colored red).

To fix a bad link, you must do one of the following:

Disabling Library Links

Simulink allows you to disable linked blocks in a model. Simulink ignores disabled links when simulating a model. To disable a link, select the link, choose Link options from the model window's Edit or context menu, then choose Disable link. To restore a disabled link, choose Restore link from the Link Options menu.

Modifying a Linked Subsystem

Simulink allows you to modify subsystems that are library links. If your modifications alter the structure of the subsystem, you must disable the link from the reference block to the library block. If you attempt to modify the structure of a subsystem link, Simulink prompts you to disable the link. Examples of structural modifications include adding or deleting a block or line or changing the number of ports on a block. Examples of nonstructural changes include changes to parameter values that do not affect the structure of the subsystem.

Propagating Link Modifications

Simulink allows a model to have active links with nonstructural but not structural changes. If you restore a link that has structural changes, Simulink prompts you to either propagate or discard the changes. If you choose to propagate the changes, Simulink updates the library block with the changes made in the reference block. If you choose to discard the changes, Simulink replaces the modified reference block with the original library block. In either case, the end result is that the reference block is an exact copy of the library block.

If you restore a link with nonstructural changes, Simulink enables the link without prompting you to propagate or discard the changes. If you want to propagate or discard the changes at a later time, select the reference block, choose Link options from the model window's Edit or context menu, then choose Propagate/Discard changes. If you want to view the nonstructural parameter differences between a reference block and its corresponding library block, choose View changes from the Link options menu.

Updating a Linked Block

Simulink updates out-of-date reference blocks in a model or library at these times:


  Working with Block Libraries Breaking a Link to a Library Block