Main Content

setDestination

Class: slreq.Link
Package: slreq

Set requirement link destination

Since R2019b

Syntax

setDestination(myLink,dest)

Description

setDestination(myLink,dest) sets the link destination artifact dest for the slreq.Link object myLink.

Input Arguments

expand all

Handle to a link, specified as an slreq.Link object.

Artifact to serve as the link destination, specified as a Requirements Toolbox linkable item. See Linkable Items.

Examples

Set Simulink Blocks as Link Destinations

% Set the Gain block in model myModel as the destination for link myLink
setDestination(myLink, 'myModel/Gain');

Set Simulink Test Objects as Link Destinations

% Create a Simulink Test 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(req, myTestcase);

% Set the link destination to the test suite
setDestination(myLink, myTestsuite);

Set Stateflow Objects as Link Destinations

% Get Stateflow Root Handle
rt = sfroot;

% Find the state with the name 'Intermediate'
myState = rt.find('-isa', 'Stateflow.State', 'Name', 'Intermediate');

% Set the destination for link myLink to myState
setDestination(myLink, myState);

Set Simulink Data Dictionary Entries as Link Destinations

% 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 destination for link myLink to myDictEntry
setDestination(myLink, myDictEntry);

Version History

Introduced in R2019b

See Also