Main Content

find

Class: slreq.Reference
Namespace: slreq

Find children of parent referenced requirements

Syntax

childRefs = find(ref,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN)

Description

childRefs = find(ref,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN) finds and returns child referenced requirements childRefs of the parent referenced requirement ref that match the properties specified by PropertyName and PropertyValue.

Input Arguments

expand all

Referenced requirement, specified as an slreq.Reference object.

Reference property name, specified as a character vector. See the valid property names in the Properties section of slreq.Reference.

Example: 'Type','Keywords','SID'

Reference property value, specified as a character vector, character array, datetime value, scalar, logical, or structure array. The data type depends on the specified propertyName. See the valid property values in the Properties section of slreq.Reference

Output Arguments

expand all

Child referenced requirements, returned as slreq.Reference objects.

Examples

expand all

This example shows how to find child referenced requirements that match property values.

Load the crs_req requirement file, which describes a cruise control system, and assign it to a variable. Find the referenced requirement with index 3, as this referenced requirement has child referenced requirements.

rs = slreq.load("crs_req");
parentRef = find(rs,"Type","Reference","Index","3")
parentRef = 
  Reference with properties:

              Id: 'Functional Requirements'
        CustomId: 'Functional Requirements'
        Artifact: 'crs_req.docx'
      ArtifactId: '?Functional Requirements'
          Domain: 'linktype_rmi_word'
       UpdatedOn: 02-Feb-2018 13:23:13
       CreatedOn: NaT
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'Functional Requirements'
     Description: '<div class=WordSection1>...'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 9
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0x0 struct]
           Index: '3'

Find the child referenced requirements of parentRef that were modified in revision 1.

childRefs1 = find(parentRef,"FileRevision",1)
childRefs1=1×18 Reference array with properties:
    Id
    CustomId
    Artifact
    ArtifactId
    Domain
    UpdatedOn
    CreatedOn
    CreatedBy
    ModifiedBy
    IsLocked
    Summary
    Description
    Rationale
    Keywords
    Type
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

Find the child referenced requirements of parentRef that were modified in revision 1 and have an SID equal to 12.

childRefs2 = find(parentRef,"FileRevision",1,"SID",12)
childRefs2 = 
  Reference with properties:

              Id: 'Activating cruise control'
        CustomId: 'Activating cruise control'
        Artifact: 'crs_req.docx'
      ArtifactId: '?Activating cruise control'
          Domain: 'linktype_rmi_word'
       UpdatedOn: 02-Feb-2018 13:23:13
       CreatedOn: NaT
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'Activating cruise control'
     Description: '<div class=WordSection1>...'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 12
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0x0 struct]
           Index: '3.3'

Tips

  • To search the loaded Requirements Toolbox objects, use the slreq.find function.

  • To search the children of a requirement, use the find method of slreq.Requirement

  • To search the children of a requirements set, use the find method of slreq.ReqSet.

  • To search the children of a link set, use the find method of slreq.LinkSet.

  • To search the children of a justification, use the find method of slreq.Justification.

Version History

Introduced in R2018a