Using Simulink Previous page   Next Page

Working with Block Libraries

Libraries are collections of blocks that can be copied into models. Blocks copied from a library remain linked to their originals such that changes in the originals automatically propagate to the copies in a model. Libraries ensure that your models automatically include the most recent versions of blocks developed by yourself or others.

Terminology

It is important to understand the terminology used with this feature.

Library - A collection of library blocks. A library must be explicitly created using New Library from the File menu.

Library block - A block in a library.

Reference block - A copy of a library block.

Link - The connection between the reference block and its library block that allows Simulink to update the reference block when the library block changes.

Copy - The operation that creates a reference block from either a library block or another reference block.

This figure illustrates this terminology.

Simulink Block Library

Simulink comes with a library of standard blocks called the Simulink block library. See Starting Simulink for information on displaying and using this library.

Creating a Library

Simulink allows you to create your own library of masked or subsystem blocks. To create a library, select Library from the New submenu of the File menu. Simulink displays a new window, labeled Library: untitled. If an untitled window already appears, a sequence number is appended.

You can create a library from the command line using this command:

This command creates a new library named 'newlib'. To display the library, use the open_system command. These commands are described in Model Construction Commands in the online Simulink reference.

Once you have create a library, you can drag blocks from models or other libraries into it.

The library must be named (saved) before you can copy blocks from it. See Adding Libraries to the Library Browser for information on how to point the Library Browser to your new library.

Modifying a Library

When you open a library, it is automatically locked and you cannot modify its contents. To unlock the library, select Unlock Library from the Edit menu. Closing the library window locks the library.


Previous page  Lookup Table Editor Creating a Library Link Next page

© 1994-2005 The MathWorks, Inc.