MATLAB: How to add custom libraries as a tree structure without spilling its contents and how to add description to the library block to be displayed in the library browser in Simulink 6.5 (R2006b)

simulink

I want to add custom libraries as a tree structure but the last level sublibrary spills out all its contents and lists as library blocks in the library browser.
I did the following:
1) I have placed optimal1.mdl library and its associated slblocks.m file, attached in the same folder and the folder is in MATLAB path.
2) I closed MATLAB and reopened it. Browsed to the directory which has optimal1.mdl library and slblocks.m.
3) I then opened Simulink library browser. Optimal1 library was listed in the browser.
4) I expanded 'Optimal', then 'Inertial',then 'Motion Detection'. I observed that all the component elements for the 'Gain Computations LTN101 requirements' in the Library got listed. But when I right clicked on 'Gain Computations LTN101 Requirements' in the Simulink library browser and selected 'open Gain Computations LTN101 Requirements Library', all the elements were connected as it should be.

Best Answer

There are two ways to restrict the substucture of a user-defined library in Simulink 7.5 (R2010a)
1) Mask the subsystem and add a parameter. Just masking it is not sufficient. You may choose to neither display nor implement this dummy parameter. For example:
In the library, Optimal.mdl, a dummy parameter 'mu' is added to the LN01 block. If this library is opened in the SIMULINK library browser, you will see that the blocks it contains are not displayed.
Regarding the block description in the SIMULINK browser, the mask description is displayed if available. If not then you can right-click on the block and enter the description in the "Block Properties". In the example above, a Subsystem has been added to the library. The Subsystem has Inports and their description is picked up from the mask description even though there is a block description in the block properties field. The subsystem however, does not have a mask description and therefore picks its description from the "block properties".
2) You may register a customization with an sl_customization.m file. There is information on this located in the documentation under Simulink -> User's Guide -> Customizing Simulink Environment and Printed Models -> Customizing the Simulink User Interface -> Customizing the Library Browser -> Disabling and Hiding Libraries