Main Content

slreq.Link class

Package: slreq

Work with link objects


When you establish a traceable association between artifacts, Requirements Toolbox™ creates an slreq.Link object to store source and destination data of the link.


link = slreq.createLink(src, dest) creates an slreq.Link object link with source and destination artifacts specified by src and dest respectively. The slreq.Link object is stored in the Link set file that belongs to src.

outLinks = slreq.outLinks(src) returns an array of slreq.Link objects outLinks that contains the outgoing links from the source artifact src.

inLinks = slreq.inLinks(dest) returns an array of slreq.Link objects inLinks that contains the incoming links to the destination artifact dest.

Input Arguments

expand all

Link source artifact, specified as a MATLAB® structure.

Link destination artifact, specified as a MATLAB structure.

Output Arguments

expand all

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

Array of outgoing links.

Array of incoming links.


expand all

The date on which the link was created, specified as a datetime value. The software populates this property.

The name of the individual or organization who created the link.

The date on which the link was last modified, specified as a datetime value. The software populates this property.

The name of the individual or organization who last modified the link.

The comments that are attached with the link, returned as a structure.

Link type enumeration, specified as one of the options in the table:

  • General relationship between items for most use cases

  • Bi-directional link

  • Specifies the source item that implements the requirement

  • Contributes to the implementation status

For more information, see Review Requirements Implementation Status.

  • Specifies which source item verifies the requirement

  • Contributes to the verification status if the source item is one of the accepted item types

For more information, see Review Requirements Verification Status.

"Derive"Specifies which source item derives the destination item
"Refine"Specifies which source item adds detail for the functionality specified by the destination item
  • Specifies relationship between a requirement and an external test result source

  • Can contribute to the verification status in certain cases

For more information, see Include Results from External Sources in Verification Status.

string scalar or character vectorString scalar or character vector that specifies a custom link type or stereotype. For more information, see Define Custom Requirement and Link Types and Properties.

For more information, see Link Types.

Link descriptive text, specified as a multi-line character vector.

Link keywords, specified as character array.

Link rationale text, specified as a multiline character vector.

The Session Independent Identifier corresponding to the link.


addCommentAdd comments to links
destination Get link destination
getAttributeGet link property values
getDestinationLabelGet label that identifies link destination
getDestinationOpenCommand Retrieve command that opens link destination
getDestinationURL Retrieve URL that opens link destination
getIncomingTypeLabel Get type label for incoming link
getOutgoingTypeLabel Get type label for outgoing link
getReferenceInfoGet unresolved link destination
getSourceLabelGet label that identifies link source
getSourceOpenCommand Retrieve command that opens link source
getSourceURL Retrieve URL that opens link source
isFilteredInCheck filtered links
isResolved Check if the link is resolved
isResolvedDestination Check if the link destination is resolved
isResolvedSource Check if the link source is resolved
linkSetReturn parent link set
removeDelete links
setAttributeSet link property values
setDestination Set requirement link destination
setSource Set requirement link source
source Get link source


collapse all

This example shows how to create a link.

Create a link between the currently selected Simulink® block and a requirement req.

link1 = slreq.createLink(gcb,req)
link1 = 

  Link with properties:

           Type: 'Implement'
    Description: 'Plant Specs'
       Keywords: [0×0 char]
      Rationale: ''
      CreatedOn: 02-Sep-2017 15:49:28
      CreatedBy: 'Jane Doe'
     ModifiedOn: 21-Oct-2017 11:34:12
     ModifiedBy: 'John Doe'
       Comments: [0×0 struct]

This example shows how to get the incoming links for a requirement.

Load a requirement set called myReqSet.

rs = slreq.load("myReqSet");

Find a requirement in the requirement with ID R1.1.

myReq = find(rs,"Type","Requirement","Id","R1.1");

Query incoming links to the requirement.

inLinks = slreq.inLinks(myReq);

This example shows how to get the outgoing links for a link source.

Load a link set called c5.slmx.

myLinkSet = slreq.load("c5.slx");

Get the link sources from the link set.

allSrcs = sources(myLinkSet);

Get the outgoing links for the first link source.

myLink = slreq.outLinks(allSrcs(1));

Version History

Introduced in R2018a