Simulink如何添加模块到Library Browser


提示:以下是本篇文章正文内容,下面案例可供参考

一、新建Library

1、创建空的Library模块

1)在Simulink界面新建一个空的Library模块

在这里插入图片描述

在这里插入图片描述

2、编辑Library

1)编辑Library逻辑并且另存为slx文件
在这里插入图片描述

二、添加到Library Browser

1、添加Library的脚本命令

1)打开Mtalab的帮助文档,搜索Slblock>>Add Library to the Library Browser
在这里插入图片描述
2)复制Slblocks脚本命令

在这里插入图片描述

function blkStruct = slblocks
% This function specifies that the library 'mylib'
% should appear in the Library Browser with the 
% name 'My Library'

    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;

2、新建脚本文件

1)在Mtalab界面新建一个脚本文件,并填入上面的代码
2)编辑需要添加的Library模块的名称(Slx文件)以及在Library Browser上面展示的名称
在这里插入图片描述

3)保存脚本文件


3、导入Library模块

1)在Library Browser列表左侧,右键选择Refresh Library Browser或者按F5更新Library列表

在这里插入图片描述
2)自动刷新到Library列表
在这里插入图片描述

综上完成Simulink Library的添加;

猜你喜欢

转载自blog.csdn.net/zataji/article/details/125114019
今日推荐