Класс: slreq. Ссылка
Пакет: slreq
Установите источник ссылки требования
setSource(myLink,src)
setSource( устанавливает программный продукт ссылки myLink,src)src для slreq.Link myLink объекта. Можно задать источник ссылки только на связываемый программный продукт, который принадлежит исходному программному продукту источника связи.
% Set the Gain block in model myModel as the source for link myLink setSource(myLink, 'myModel/Gain');
% Create a test file, test suite, and a test case myTestfile = sltest.testmanager.TestFile('my_test_file.mldatx'); myTestsuite = sltest.testmanager.TestSuite(myTestfile,'My Test Suite'); myTestcase = sltest.testmanager.TestCase(myTestsuite,'equivalence','Equivalence Test Case'); % Create a link from the test case to requirement myReq myLink = slreq.createLink(myTestcase, req); % Set the link source to the test suite setSource(myLink, myTestsuite);
% Get Stateflow Root Handle rt = sfroot; % Find the state with the name 'Intermediate' myState = rt.find('-isa', 'Stateflow.State', 'Name', 'Intermediate'); % Set the source for link myLink to myState setSource(myLink, myState);
% Get handle to Simulink data dictionary entry myDict = Simulink.data.dictionary.open('myDictionary.sldd'); dataSectObj = getSection(myDict,'Design Data'); myDictEntry = getEntry(dataSectObj,'myEntry'); % Set the source for link myLink to myDictEntry setSource(myLink, myDictEntry);
% Get destination of link link_1 dest = destination(link_1); % Create a new link, link_2, with source newSrc and destination dest link_2 = slreq.createLink(newSrc, dest); % Copy link properties link_2.Description = link_1.Description; link_2.Rationale = link_1.Rationale; link_2.Keywords = link_1.Keywords; comments = link_1.Comments; for i = 1:length(comments) link_2.addComment(comments(i).Text); end % Delete link_1 remove(link_1);