| Contents | Index |
| On this page… |
|---|
The order in which a library appears in the Library Browser is determined by its name and its sort priority. Libraries appear in the Library Browser's tree view in ascending order of priority, with all blocks having the same priority sorted alphabetically. The Simulink library has a sort priority of -1 by default; all other libraries, a sort priority of 0. This guarantees that the Simulink library is by default the first library displayed in the Library Browser. You can reorder libraries by changing their sort priorities. To change library sort priorities, insert a line of code of the following form in an sl_customization.m file (see Registering Customizations) on the MATLAB path:
cm.LibraryBrowserCustomizer.applyOrder( {'LIBNAME1', PRIORITY1, ...
'LIBNAME2, 'PRIORITY2, ...
.
.
'LIBNAMEN', PRIORITYN} );
where LIBNAMEn is the name of the library or its .mdl file and PRIORITYn is an integer indicating the library's sort priority. For example, the following code moves the Simulink Extras library to the top of the Library Browser's tree view.
cm.LibraryBrowserCustomizer.applyOrder( {'Simulink Extras', -2} );
To disable or hide libraries, sublibraries, or library blocks, insert code of the following form in an sl_customization.m file (see Registering Customizations) on the MATLAB path:
cm.LibraryBrowserCustomizer.applyFilter( {'PATH1', 'STATE1', ...
'PATH2', 'STATE2', ...
.
.
'PATHN', 'STATEN'} );
where PATHn is the path of the library, sublibrary, or block to be disabled or hidden and 'STATEn' is 'Disabled' or 'Hidden'. For example, the following code hides the Simulink Sources sublibrary and disables the Sinks sublibrary.
cm.LibraryBrowserCustomizer.applyFilter({'Simulink/Sources','Hidden'});
cm.LibraryBrowserCustomizer.applyFilter({'Simulink/Sinks','Disabled'});
You can perform the same kinds of customizations to the Library Browser's menu as you can to the model and Stateflow editor menus. Simply use the corresponding Library Browser menu tags to perform the customizations.
LibraryBrowser:FileMenu
LibraryBrowser:EditMenu
LibraryBrowser:ViewMenu
LibraryBrowser:HelpMenu
For example, the following code adds a menu item to the Library Browser's file menu:
%Menu customization:
% Add items to the Library Browser File menu
cm.addCustomMenuFcn('LibraryBrowser:FileMenu',@getMyMenuItems)
%% Define the custom menu function.
function schemaFcns = getMyMenuItems(callbackInfo)
schemaFcns = {@myBasic};
end
%% Define the schema function for first menu item.
function schema = myBasic(callbackInfo)
disp('1');
schema = sl_action_schema;
schema.label = 'Display 1';
schema.userdata = 'item one';
schema.tag = 'LibraryBrowser:ItemOne';
end
![]() | Disabling and Hiding Dialog Box Controls | Registering Customizations | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |