Main Content


Class: slreq.Requirement
Package: slreq

Add child requirement


reqChild = add(req)
reqChild = add(req,PropertyName,PropertyValue,...,PropertyNameN,PropertyValueN)


reqChild = add(req) adds a child requirement to the requirement req and returns a handle to the child requirement.

reqChild = add(req,PropertyName,PropertyValue,...,PropertyNameN,PropertyValueN) adds a child requirement with the properties and property values specified by PropertyName and PropertyValue.

Input Arguments

expand all

Requirement, specified as an slreq.Requirement object.

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

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

Example: "Summary"

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

Output Arguments

expand all

New child requirement, returned as an slreq.Requirement object.


expand all

This example shows how to add a child requirement under a requirement.

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

rs = slreq.load("myReqSet");

Use the add method to add a top-level requirement to the requirement set.

req = add(rs);

Use the add method to add a child requirement under the requirement.

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

            Type: 'Functional'
              Id: '#3'
         Summary: ''
     Description: ''
        Keywords: {}
       Rationale: ''
       CreatedOn: 19-Aug-2023 15:05:58
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 3
    FileRevision: 1
      ModifiedOn: 19-Aug-2023 15:05:58
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1.1'

Get the value of the Index property for the new requirement.

idx = newReq.Index
idx = 

The value indicates that the new requirement is a child requirement of the original requirement.


Discard the requirement set without saving.



Version History

Introduced in R2018a