Main Content

getRegisteredReqSets

Class: slreq.LinkSet
Package: slreq

Get requirement sets registered in link set

Syntax

registeredReqSets = getRegisteredReqSets(myLinkSet)

Description

registeredReqSets = getRegisteredReqSets(myLinkSet) returns a cell array of the file names of the requirement sets registered to the link set myLinkSet.

Input Arguments

expand all

Link set, specified as an slreq.LinkSet object.

Output Arguments

expand all

File names of requirement sets registered in the link set, returned as a cell array.

Examples

expand all

This example shows how to get and update the requirement sets registered in a link set.

Open the Requirements Definition for a Cruise Control Model project.

slreqCCProjectStart;

Load the crs_req requirement set, which describes a cruise control system. This action also loads the crs_req link set and the crs_req_func_spec requirement set.

slreq.load("crs_req");

Find the crs_req link set and the crs_req_func_spec requirement set.

myLinkSet = slreq.find("Type","LinkSet","Name","crs_req");
rs = slreq.find("Type","ReqSet","Name","crs_req_func_spec");

Get the requirement sets registered in the crs_req link set.

registeredReqSets = getRegisteredReqSets(myLinkSet)
registeredReqSets = 1x1 cell array
    {'/tmp/Bdoc22a_1891349_100522/bml.batserve.065631/MATLAB/Projects/examples/CruiseRequirementsExample1/documents/crs_req_func_spec.slreqx'}

Get the links from the crs_req link set. Remove all of the links from the crs_req link set and close the crs_req_func_spec requirement set.

links = getLinks(myLinkSet);
for i = 1:numel(links)
    remove(links(i));
end
close(rs);

Update the requirement sets registered to the link set crs_req. Confirm that the requirement set crs_req_func_spec is not registered in the link set crs_req by getting the currently registered requirement sets.

updateRegisteredReqSets(myLinkSet)
registeredReqSets = getRegisteredReqSets(myLinkSet)
registeredReqSets =

  0x0 empty cell array

Cleanup

Clear the open requirement sets and link sets. Close the Requirements Definition for a Cruise Control Model project.

slreq.clear;
close(currentProject);

Tips

  • When you create a link to a requirement, the requirement set of the requirement becomes registered to the link set of the link. If you delete the link to the requirement, you must manually unregister the requirement set from the link set. You can update the registered requirement sets by using updateRegisteredReqSets.

  • You can register a requirement set without creating a link by opening a requirement set in the Requirements Perspective in the Simulink® model editor.

Version History

Introduced in R2021b