选择新建空白库,保存在自定义文件夹中,命名为mylib.slx。(名字可以随便起,但是要和下面脚本对应上)

在新建一个脚本文件,命名为slblocks.m

function blkStruct = slblocks
        % This function specifies that the library should appear
        % in the Library Browser
        % and be cached in the browser repository

        Browser.Library = 'mylib';
        % 'mylib' is the name of the library

        Browser.Name = 'My Library';
        % 'My Library' is the library name that appears 
             % in the Library Browser

        blkStruct.Browser = Browser; 

设置路径,将库存放的文件夹,添加到matlab搜索路径中,

在simulink library browser中刷新所有库文件。

此时就可以看到自己自定义的库了

最后修改:2019 年 11 月 10 日
如果觉得我的文章对你有用,请随意赞赏