slreq.find

Find requirement, reference, and link set artifacts

Description

myArtifacts = slreq.find('Type',ArtifactType) finds and returns all loaded Simulink® Requirements™ artifacts myArtifacts of the type specified by ArtifactType.

myArtifact = slreq.find('Type',ArtifactType,'PropertyName','PropertyValue') finds and returns a Simulink Requirements artifact myArtifact of the type specified by ArtifactType matching the additional properties specified by PropertyName and PropertyValue.

myReqs = slreq.find('Type',ArtifactType,'ReqType',ReqTypeValue) finds and returns all requirements myReqs of the type specified by ReqTypeValue.

myLinks = slreq.find('Type',ArtifactType,'LinkType',LinkTypeValue) finds and returns all requirements myLinks of the type specified by LinkTypeValue.

Examples

Find Requirement Sets

% Find all requirement sets

allReqSets = slreq.find('Type', 'ReqSet')

allReqSets = 

  1×8 ReqSet array with properties:

    Description
    Name
    Filename
    Revision
    Dirty
    CustomAttributeNames

% Find a requirement set with matching property values
myReqSet = slreq.find('Type', 'ReqSet', 'Name', 'My_Req_Set', 'Revision', 65)

myReqSet = 

  ReqSet with properties:

             Description: ''
                    Name: 'My_Req_Set'
                Filename: 'C:\MATLAB\My_Req_Set.slreqx'
                Revision: 65
                   Dirty: 0
    CustomAttributeNames: {}

Find Requirements

% Find all requirements in all loaded requirement sets
allReqs = slreq.find('Type', 'Requirement')

allReqs = 

  1×72 Requirement array with properties:

    Id
    Summary
    Keywords
    Description
    Rationale
    SID
    CreatedBy
    CreatedOn
    ModifiedBy
    ModifiedOn
    FileRevision
    Dirty
    Comments

% Find a requirement with matching property value
myReq = slreq.find('Type', 'Requirement', 'Id', '#19')

myReq = 

  Requirement with properties:

              Id: '#19'
         Summary: 'Control Mode'
        Keywords: [0×0 char]
     Description: ''
       Rationale: ''
             SID: 19
       CreatedBy: 'Jane Doe'
       CreatedOn: 27-Feb-2017 10:15:38
      ModifiedBy: 'John Doe'
      ModifiedOn: 02-Aug-2017 15:18:55
    FileRevision: 52
           Dirty: 0
        Comments: [0×0 struct]

Find Referenced Requirements

% Find all referenced requirements in all loaded requirement sets
allRefs = slreq.find('Type', 'Reference')

allRefs = 

  1×24 Reference array with properties:

    Keywords
    Artifact
    Id
    Summary
    Description
    SID
    Domain
    SynchronizedOn
    ModifiedOn

% Find a referenced requirement with matching property value
myRef = slreq.find('Type', 'Reference', 'Id', '#26')

myRef = 

  Reference with properties:

          Keywords: [0×0 char]
          Artifact: 'My_req_doc.docx'
                Id: '#26'
           Summary: 'Overview'
       Description: ''
               SID: 2
            Domain: 'linktype_rmi_word'
    SynchronizedOn: 25-Jul-2017 11:34:02
        ModifiedOn: 16-Aug-2017 13:01:55

Find Link Sets

% Find all loaded link sets

allLinkSets = slreq.find('Type', 'LinkSet')

allLinkSets = 

  1×2 LinkSet array with properties:

    Description
    Filename
    Artifact
    Domain
    Revision
    Dirty

% Find a link set with matching property values
myLinkSet = slreq.find('Type', 'LinkSet', 'Domain', 'linktype_rmi_slreq')

myLinkSet = 

  LinkSet with properties:

    Description: ''
       Filename: 'C:\MATLAB\My_Reqs.slmx'
       Artifact: 'C:\MATLAB\My_Reqs.slreqx'
         Domain: 'linktype_rmi_slreq'
       Revision: 2
          Dirty: 0

Find Requirements and Links by Type

% Find all Functional requirements
myFunctionalReqs = slreq.find('Type', 'Requirement', 'ReqType', 'Functional')

myFunctionalReqs = 

  1×70 Requirement array with properties:

    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments

% Find all Links of type Implement
myImplementLinks = slreq.find('Type', 'Link', 'LinkType', 'Implement')

myImplementLinks = 

  1×95 Link array with properties:

    Type
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedOn
    ModifiedBy
    Revision
    Comments

Input Arguments

collapse all

The Simulink Requirements artifact to find.

Requirement type. For more information, see Requirement Types.

Link type. For more information, see Link Types.

Output Arguments

collapse all

Simulink Requirements artifacts, returned as arrays of the respective data type.

Simulink Requirements artifact, returned as the respective data type.

Requirement objects matching the requirement type specified by ReqTypeValue, returned as an slreq.Requirement object or as an array of slreq.Requirement objects.

Link objects matching the link type specified by LinkTypeValue, returned as an slreq.Link object or as an array of slreq.Link objects.

Introduced in R2018a