|On this page…|
You can add your own library to the Library Browser. To learn more about creating a library, see Create Block Libraries.
Add your top-level library and its sublibraries to the MATLAB® path. Make sure all libraries that you are adding are in .slx format.
Open the library and unlock it by selecting Diagram > Unlock Library.
Enable the model property EnableLBRepository by entering set_param(gcs, 'EnableLBRepository','on'); at the MATLAB command prompt.
In the same folder as your library, create an slblocks.m file. You can create it in two ways.
If a minimal slblocks.m file meets your needs, then create a new file based on Example of a Minimal slblocks.m File.
If you want to modify how the library is displayed in the Library Browser, such as showing sublibraries or putting the library on top of other libraries, consider using an existing slblocks.m file as a template. You can view information you might want to include in your slblocks.m file by examining the comments in the supplied Simulink® library slblocks.m file: matlabroot/toolbox/simulink/blocks/slblocks.mmatlabroot/toolbox/simulink/blocks/slblocks.m.
Open the Library Browser and press F5 to refresh it.
After the refresh, your library appears in the Library Browser.
To display a library in the Library Browser, your slblocks.m file must, at a minimum, include this code:
function blkStruct = slblocks % Specify that the product should appear in the library browser % and be cached in its repository Browser.Library = 'mylib'; Browser.Name = 'My Library'; blkStruct.Browser = Browser;