Custom Libraries

Reusable libraries of blocks and subsystems

A block library is a collection of blocks that you can use in a Simulink® model. You can create instances of blocks from built-in Simulink libraries, and you can make custom libraries for instances of blocks that you create.

You can access the built-in libraries from the Simulink Library Browser. However, you cannot modify these libraries. For more information on built-in libraries, see Block Libraries. To enable others to create custom blocks, you can create your own block library and add it to the Library Browser.

Creating your own libraries is a useful componentization technique for:

  • Providing frequently used, and seldom changed, modeling utilities

  • Reusing components in a model or in multiple models

To learn how using custom libraries compares to other Simulink componentization techniques, see Component-Based Modeling Guidelines.

When you add blocks from a custom library to a model, the block you add becomes a linked block. A linked block connects to the library block by way of a library link. The library block is the prototype block, and the linked block in the model is an instance of the library block.

The linked block looks and acts like the library block. However, if you change the library block, you need to update the link on the instances. Making changes to an instance can also require additional steps. To learn how linked blocks work, see Linked Blocks.

Blocks

SubsystemGroup blocks to create model hierarchy
Unresolved LinkIndicate unresolved reference to library block

Functions

libinfoGet information about library blocks referenced by model
gcbGet path name of current block
gcbhGet handle of current block

Classes

LibraryBrowser.LibraryBrowser2Simulink Library Browser

Topics

Library Browser

Create a Custom Library

Add blocks and annotations to a custom library and define the library structure.

Component-Based Modeling Guidelines

Consider componentization for large models and multiuser development teams.

Add Libraries to the Library Browser

Create a library, add it to the library browser, and customize library order.

Library Links

Linked Blocks

Explore linked blocks, parameterized links, and self-modifiable linked subsystems.

Display Library Links

Identify link status using the link badge.

Disable or Break Links to Library Blocks

Disable library links.

Lock Links to Blocks in a Library

Prevent unintentional disabling of library links.

Restore Disabled or Parameterized Links

Restore library links and link inconsistency.

Control Linked Block Programmatically

Use MATLAB® commands to manage linked blocks.

Fix Unresolved Library Links

Handle unresolved library links.

Parameterized Links and Self-Modifiable Linked Subsystems

Modify a parameter value or structure of linked Subsystem block.

Forwarding Tables

Map old and new library blocks using forwarding tables.