Main Content


Class: slreq.Requirement
Package: slreq

Find parent item of requirement


parentObj = parent(req)


parentObj = parent(req) returns the parent object parentObj of the slreq.Requirement object req.

Input Arguments

expand all

Requirement specified as an slreq.Requirement object.

Output Arguments

expand all

The parent of the requirement req, returned as an slreq.Requirement object or as an slreq.ReqSet object.


Find Parent Objects of Requirements

% Load a requirements set file and add two new requirements
rs = slreq.load('C:\MATLAB\My_Requirements_Set_1.slreqx');
req1 = add(rs, 'Id', '5', 'Summary' , 'Additional Requirement'); 
req2 = add(req1, 'Id', '5.1', 'Summary' , 'Additional Child Requirement');

% Find the parent of req2
parentReq1 = parent(req2)

parentReq1 = 

  Requirement with properties:

             Id: '5'
        Summary: 'Additional Requirement'
       Keywords: [0×0 char]
    Description: ''
      Rationale: ''
            SID: 10
      CreatedBy: 'John Doe'
      CreatedOn: 05-Oct-2007 16:09:38
     ModifiedBy: 'Jane Doe'
     ModifiedOn: 21-Dec-2016 11:10:05
       Comments: [0×0 struct]

% Find the parent of req1
parentReq2 = parent(req1)

parentReq2 = 

  ReqSet with properties:

             Description: ''
                    Name: 'My_Requirements_Set_1'
                Filename: 'C:\MATLAB\My_Requirements_Set_1.slreqx'
                Revision: 6
                   Dirty: 1
    CustomAttributeNames: {}

Introduced in R2018a