主要内容

setSource

班级:slreq.link
包裹:Slreq

设置需求链接源

句法

SetSource(MyLink,SRC)

描述

setSource(mylink,,,,src设置链接源工件src为了slreq.link目的mylink。您只能将链接源设置为属于原始链接源工件的可链接伪像。

输入参数

展开全部

处理链接,指定为slreq.link目的。

作为链接源的工件,指定为需求工具箱可连接的工件。看可连接的项目

例子

金宝app作为链接源的块

%将模型mymodel中的增益块设置为链接mylink的来源setSource(mylink,'mymodel/age');

金宝app测试对象作为链接源

%创建一个测试文件,测试套件和测试用例mytestfile = sltest.testmanager.testfile('my_test_file.mldatx');mytestsuite = sltest.testmanager.testsuite(mytestfile,“我的测试套件”);mytestcase = sltest.testmanager.testcase(mytestsuite,'等价',,,,“等效测试案例”);%创建从测试案例到需求myReq的链接mylink = slreq.createlink(mytestcase,req);%将链接源设置为测试套件setSource(mylink,mytestsuite);

状态流对象作为链接源

%获取状态流根手柄rt = sfroot;%找到名称为“中级”的状态mystate = rt.find('-isa',,,,'stateflow.state',,,,'姓名',,,,'中间的');%设置链接MyLink到Mystate的来源setSource(mylink,mystate);

金宝app数据字典条目作为链接源

%获取模拟数据字典条目金宝appmydict = 金宝appsimulink.data.dictionary.open('mydictionary.sldd');datasectobj = getection(mydict,“设计数据”);myDictentry = getentry(datasectobj,'myentry');%为链接mylink与myDictentry设置了源setSource(mylink,mydictentry);

将链接源更改为其他源工件

%获取链接的目的地链接_1dest = destination(link_1);%创建一个新的链接link_2,source newsrc和destination destlink_2 = slreq.createlink(newsrc,dest);%复制链接属性link_2.description = link_1.description;link_2.rationale = link_1.rationale;link_2.keywords = link_1.keywords;注释= link_1.comments;为了i = 1:长度(注释)link_2.addcomment(注释(i).text);结尾%delete link_1删除(link_1);

版本历史记录

在R2019b中引入

也可以看看