Add Libraries to the Library Browser

You can add your own library to the Library Browser. To learn more about creating a library, see Create Block Libraries.

  1. Add your top-level library and its sublibraries to the MATLAB® path. Make sure all libraries that you are adding are in .slx format.

  2. Open the library and unlock it by selecting Diagram > Unlock Library.

  3. Enable the model property EnableLBRepository by entering set_param(gcs, 'EnableLBRepository','on'); at the MATLAB command prompt.

  4. In the same folder as your library, create an slblocks.m file. You can create it in two ways.

  5. Open the Library Browser and press F5 to refresh it.

After the refresh, your library appears in the Library Browser.

Example of a Minimal slblocks.m File

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;
Was this topic helpful?