Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

setSource

クラス: slreq.Link
名前空間: slreq

要件のリンク元を設定

R2019b 以降

構文

setSource(myLink,src)

説明

setSource(myLink,src) は、slreq.Link オブジェクト myLink のリンク元項目 src を設定します。リンク元は、元のリンク元アーティファクトに属するリンク可能な項目にのみ設定できます。

入力引数

すべて展開する

リンクへのハンドル。slreq.Link オブジェクトとして指定します。

リンク元となる項目。Requirements Toolbox のリンク可能な項目として指定します。リンク可能な項目を参照してください。

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 で導入