Main Content

slreq.generateTraceabilityDiagram

Create a traceability diagram

    Description

    example

    slreq.generateTraceabilityDiagram(startingItem) creates a traceability diagram that originates from startingItem. If a traceability diagram is already open for the specified item, the diagram comes to the foreground.

    Note

    If you create a diagram from a link, the link source is the starting node. Similarly, if you create a diagram from a link set, the artifact specified by the Artifact is the starting node.

    Examples

    collapse all

    This example shows how to create a traceability diagram from a requirement object.

    Open the Requirements Definition for a Cruise Control Model project. Load the crs_req_func_spec requirment set.

    slreqCCProjectStart;
    slreq.load("crs_req_func_spec");

    Find the Enable Switch Detection requirement.

    req = slreq.find(Type="Requirement",Summary="Enable Switch Detection")
    req = 
      Requirement with properties:
    
                Type: 'Functional'
                  Id: '#9'
             Summary: 'Enable Switch Detection'
         Description: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">...'
            Keywords: {}
           Rationale: ''
           CreatedOn: 27-Feb-2017 10:15:38
           CreatedBy: 'itoy'
          ModifiedBy: 'asriram'
        IndexEnabled: 1
         IndexNumber: []
                 SID: 9
        FileRevision: 55
          ModifiedOn: 03-Aug-2017 14:39:35
               Dirty: 0
            Comments: [0x0 struct]
               Index: '1.6'
    
    

    Create a traceability diagram for the Enable Switch Detection requirement.

    slreq.generateTraceabilityDiagram(req)

    Cleanup

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

    slreq.clear;
    close(currentProject);

    This example shows how to create a traceability diagram from a link object.

    Open the Requirements Definition for a Cruise Control Model project. Load the crs_req requirement set, which also loads the crs_req link set.

    slreqCCProjectStart;
    slreq.load("crs_req");

    Find the crs_req link set. Then find the link with description #9: Enable Switch Detection.

    myLinkSet = slreq.find(Type="LinkSet",Name="crs_req");
    myLink = find(myLinkSet,Type="Link",Description="#9: Enable Switch Detection")
    myLink = 
      Link with properties:
    
               Type: 'Derive'
        Description: '#9: Enable Switch Detection'
           Keywords: {}
          Rationale: ''
          CreatedOn: 20-May-2017 13:14:10
          CreatedBy: 'itoy'
         ModifiedOn: 02-Feb-2018 14:28:04
         ModifiedBy: 'itoy'
           Revision: 4
                SID: 1
           Comments: [0x0 struct]
    
    

    Create a traceability diagram from the link.

    slreq.generateTraceabilityDiagram(myLink)

    Cleanup

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

    slreq.clear;
    close(currentProject);

    This example shows how to create a traceability diagram from a requirement set.

    Open the Requirements Definition for a Cruise Control Model project. Load the crs_req_func_spec requirement set.

    slreqCCProjectStart;
    rs = slreq.load("crs_req_func_spec");

    Create a traceability diagram for the crs_req_func_spec requirement set by using the relative file path.

    relpath = fullfile("documents","crs_req_func_spec.slreqx")
    relpath = 
    "documents/crs_req_func_spec.slreqx"
    
    slreq.generateTraceabilityDiagram(relpath)

    Cleanup

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

    slreq.clear;
    close(currentProject);

    This example shows how to create a traceability diagram from a link set.

    Open the Requirements Definition for a Cruise Control Model project. Load the crs_req link set.

    slreqCCProjectStart;
    ls = slreq.load("crs_req.slmx");

    Create a traceability diagram for the crs_req link set by using the relative file path.

    relpath = fullfile("documents","crs_req.slmx")
    relpath = 
    "documents/crs_req.slmx"
    
    slreq.generateTraceabilityDiagram(relpath)

    Cleanup

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

    slreq.clear;
    close(currentProject);

    Input Arguments

    collapse all

    Starting item to create the traceability diagram from, specified as a:

    Version History

    Introduced in R2021b