Main Content

add

Class: slreq.ReqSet
Namespace: slreq

Add requirements to requirement set

Syntax

req = add(rs)
req = add(rs,"Artifact",artifactName)
req = add(___,reqProperty,value,...,refPropertyN,valueN)

Description

req = add(rs) adds a requirement to the requirement set rs and returns a handle to the requirement.

req = add(rs,"Artifact",artifactName) adds a referenced requirement associated with the external requirements document, artifactName.

req = add(___,reqProperty,value,...,refPropertyN,valueN) adds a requirement or a referenced requirement to the requirement set with properties and property values specified by reqProperty and value, respectively.

Input Arguments

expand all

Requirement set, specified as an slreq.ReqSet object.

Requirement or referenced requirement property name, specified as a string scalar or a character vector.

You can only enter an slreq.Requirement property or slreq.Reference property where the SetAccess attribute is public.

Example: "Summary"

Requirement or referenced requirement property value, specified as an string scalar or a character vector.

External requirements document name, specified as a string scalar or a character vector.

Output Arguments

expand all

Requirement or referenced requirement, returned as an slreq.Requirement or an slreq.Reference object.

Examples

expand all

This example shows how to add a requirement to a requirement set.

Load the requirement set myReqSet, which does not contain any requirements.

rs = slreq.load("myReqSet");

Use the add method to add a requirement to the requirement set.

req = add(rs)
req = 
  Requirement with properties:

            Type: 'Functional'
              Id: '#2'
         Summary: ''
     Description: ''
        Keywords: {}
       Rationale: ''
       CreatedOn: 05-Sep-2024 22:40:35
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 05-Sep-2024 22:40:35
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

Cleanup

Discard the requirement set without saving.

discard(rs);

This example shows how to add a referenced requirement to a requirement set.

Load the crs_req requirement set.

rs = slreq.load("crs_req");

Use the add method to add a referenced requirement to the requirement set as an Import node. Associate the Import node with the crs_req.docx file as the external requirements artifact.

ref = add(rs,"Artifact","crs_req.docx")
ref = 
  Reference with properties:

              Id: ''
        CustomId: ''
        Artifact: 'crs_req.docx'
      ArtifactId: ''
          Domain: 'linktype_rmi_word'
       UpdatedOn: 19-Apr-2023 15:57:41
       CreatedOn: 19-Apr-2023 15:57:41
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: ''
     Description: ''
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 32
    FileRevision: 1
      ModifiedOn: 19-Apr-2023 15:57:41
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

This example shows how to specify properties when adding a requirement to a requirement set.

Load the requirement set myReqSet, which does not contain any requirements.

rs = slreq.load("myReqSet");

Use the add method to add a requirement to the requirement set. Set the requirement summary to New Req and set the requirement description to My new requirement.

req = add(rs,"Summary","New Req","Description","My new requirement")
req = 
  Requirement with properties:

            Type: 'Functional'
              Id: '#2'
         Summary: 'New Req'
     Description: 'My new requirement'
        Keywords: {}
       Rationale: ''
       CreatedOn: 05-Sep-2024 22:40:36
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 05-Sep-2024 22:40:36
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

Cleanup

Discard the requirement set without saving.

discard(rs);

This example shows how to specify properties when adding a referenced requirement to a requirement set.

Load the crs_req requirement set.

rs = slreq.load("crs_req");

Use the add method to add a referenced requirement to the requirement set as an Import node. Associate the Import node with the crs_req.docx file as the external requirements artifact. Set the requirement summary to New Import Node and set the requirement description to My new Import node.

ref = add(rs,"Artifact","crs_req.docx","Summary","New Import Node", ...
    "Description","My new Import node")
ref = 
  Reference with properties:

              Id: ''
        CustomId: ''
        Artifact: 'crs_req.docx'
      ArtifactId: ''
          Domain: 'linktype_rmi_word'
       UpdatedOn: 10-Jul-2024 11:56:20
       CreatedOn: 10-Jul-2024 11:56:20
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'New Import Node'
     Description: 'My new Import node'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 32
    FileRevision: 1
      ModifiedOn: 10-Jul-2024 11:56:20
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

Tips

  • To add a requirement as a child of another requirement, use the add method of slreq.Requirement. To add a referenced requirement as a child of another referenced requirement, use the add method of slreq.Reference. To add a justification as a child of another justification, use the add method of slreq.Justification.

Version History

Introduced in R2017b