为了方便调用,有时候需要添加自定义的模块到simulink库中。
在需要添加模块的目录下新建一个脚本并拷贝一下信息:
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;
解决办法:①将所包含的文件夹放在simulink的路径的新建文件夹下。命令行输入pathtool->找一个文件夹在目录下新建一个文件夹->将所要添加模块的文件粘贴到目录下->在simulink左栏中打开文件夹->刷新simulink库就可以看到添加的模块
②将需要添加模块的文件所在路径添加到MATLAB的路径下。命令行输入pathtool->添加路径
仅供参考