setSource
クラス: slreq.Link
パッケージ: slreq
構文
setSource(myLink,src)
説明
setSource(
は、myLink
,src
)slreq.Link
オブジェクト myLink
のリンク元アーティファクト src
を設定します。リンク元は、元のリンク元アーティファクトに属するリンク可能なアーティファクトにのみ設定できます。
入力引数
例
Simulink ブロックをリンク元として設定
% Set the Gain block in model myModel as the source for link myLink setSource(myLink, 'myModel/Gain');
Simulink Test オブジェクトをリンク元として設定
% 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);
Stateflow オブジェクトをリンク元として設定
% 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);
Simulink データ ディクショナリ エントリをリンク元として設定
% 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);
バージョン履歴
R2019b で導入