xmcImportFunction
command you must prepare your library using the following
process.- Enable Library Browser parameter.
- Save the library.
- Create slblocks.m script for the library.
- Add path to MATLAB, or add library to MATLAB path.
- Refresh Library Browser.
To enable the library to be available in the Library Browser, you must turn
on the EnableLBRepository
parameter for the library. After
importing a block into a new library using xmcImportFunction
,
with the library open, you must use the following command from the MATLAB
command line prior to saving your library:
set_param(gcs,'EnableLBRepository','on');
This parameter identifies the library as belonging to the Library Browser. However, that is just the first step. Save the library by using the
command from the main menu, or by clicking on the button in the toolbar.function blkStruct = slblocks
% This function adds the library to the Library Browser
% and caches it in the browser repository
% Specify the name of the library
Browser.Library = 'newlib';
% Specify a name to display in the library Browser
Browser.Name = 'New Library';
blkStruct.Browser = Browser;
Browser.Library
specifies the
name of the library model minus the .slx file extension,
and Browser.Name
specifies the display name that will appear
in Library Browser.path
at the MATLAB command prompt to see the current path that MATLAB uses. You can also add the library directory to the MATLAB path using the following
commands:addpath ('library_folder')
savepath
-
'library_folder'
savepath
is a string that saves the current search path to pathdef.m.
rmpath ('library_folder')
savepath
Finally, to view the new library in the Library Browser, from the left side of the Library Browser window right-click and select the Refresh Library Browser command. This will load the library into the tool. You should now be able to view the imported blocks and drag and drop them into your models.