Main Content

source

Class:slreq.Link
Package:slreq

Get link source

Description

example

src = source(myLink)returns a link source of the linkmyLink.

Input Arguments

expand all

Link, specified as anslreq.Linkobject.

Output Arguments

expand all

Link source, returned as a MATLAB®structure that contains these fields:

  • domain

  • artifact

  • id

Examples

expand all

This example shows how to get a link source from a link object.

Open theRequirements Definition for a Cruise Control Modelproject. Load thecrs_reqrequirement set, which also loads thecrs_reqlink set.

slreqCCProjectStart; slreq.load("crs_req");

Find thecrs_reqlink set.

myLinkSet = slreq.find(Type="LinkSet",Name="crs_req");

Get the links from the link set.

myLinks = getLinks(myLinkSet)
myLinks=1×12 object1x12 Link array with properties: Type Description Keywords Rationale CreatedOn CreatedBy ModifiedOn ModifiedBy Revision SID Comments

Get the link source structure for one of the links.

src = source(myLinks(1))
src =struct with fields:domain: 'linktype_rmi_slreq' artifact: '/tmp/Bdoc22a_1891349_99509/bml.batserve.147285/MATLAB/Projects/examples/CruiseRequirementsExample5/documents/crs_req.slreqx' id: '10'

Convert the link source structure to an object.

srcObj = slreq.structToObj(src)
srcObj = Reference with properties: Id: 'Enabling cruise control' CustomId: 'Enabling cruise control' Artifact: 'crs_req.docx' ArtifactId: '?Enabling cruise control' Domain: 'linktype_rmi_word' UpdatedOn: 02-Feb-2018 13:23:13 CreatedOn: NaT CreatedBy: '' ModifiedBy: '' IsLocked: 1 Summary: 'Enabling cruise control' Description: '
...' Rationale: '' Keywords: {} Type: 'Functional' IndexEnabled: 1 IndexNumber: [] SID: 10 FileRevision: 1 ModifiedOn: 03-Aug-2017 17:34:56 Dirty: 0 Comments: [0x0 struct] Index: '3.1'

Cleanup

Clear the open requirement sets and link sets. Close the current project.

slreq.clear; slproject.closeCurrentProject();

Tips

版本历史

Introduced in R2018a