setParent(ref,parentID) moves
the referenced requirement ref under the parent referenced requirement
specified by parentID. You can only use this method in the
PostImportFcn callback.
This example shows how to assign a script as the PostImportFcn callback for an Import node. You get the contents of the PostImportFcn callback for an Import node and register a different script after you import the requirements.
Import the Requirements
Use slreq.import to import the ReqIF file mySpec.reqif into Requirements Toolbox™. Name the imported requirement set myReqSet, register the script myPreImportScript2 as the PreImportFcn, and register the script myPostImportScript as the PostImportFcn callback. Return a handle to the requirement set.
The script myPreImportScript2 uses slreq.getCurrentImportOptions to get the import options, then specifies the attribute mapping file to use during import.
The mapping file myMappingFile2.xml maps these attributes from the ReqIF™ file to these properties in Requirements Toolbox™:
ReqSum to Summary
Desc to Description
ID to Custom ID
The script myPostImportScript uses slreq.getCurrentObject to get a handle to the Import node, gets the requirement set that the Import node belongs to, and then finds requirements that have the summary Requirement 1 and Requirement 2. Then, the script moves Requirement 2 under Requirement 1.
Get a handle to the Import node, then register the script myPostImportScrip2 as the PostImportFcn callback. Confirm that the contents of the callback changed.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.