Main Content

find

Class: slreq.LinkSet
Namespace: slreq

Find links in link set with matching attribute values

Syntax

myLinks = find(myLinkSet,"PropertyName1",PropertyValue1,...,"PropertyNameN",PropertyValueN)

Description

myLinks = find(myLinkSet,"PropertyName1",PropertyValue1,...,"PropertyNameN",PropertyValueN) returns links in the link set myLinkSet that match the properties specified by PropertyName and PropertyValue.

Input Arguments

expand all

Link set, specified as an slreq.LinkSet object.

Link property name, specified as a string scalar or a character vector that contains the name of an slreq.Link property name or a link destination attribute. For a list of valid property names, see the valid property names in the Properties section of slreq.Link.

The valid link destination attributes are:

  • "destination.domain"

  • "desintation.artifact"

  • "destination.id"

  • "destination.summary"

The link destination attributes correspond to the structure fields of the output of the destination method.

Example: 'Type','Keywords','SID'

Link property value, specified as a character vector, character array, datetime value, scalar, logical, or structure array. The data type depends on the specified PropertyName. See the valid property values in the Properties section of slreq.Link.

Example: 'Type','Keywords','SID'

Output Arguments

expand all

Links, returned as an slreq.Link array.

Examples

expand all

This example shows how to find a link in a link set that matches the specified property value.

Load the myAddRequirements requirement set, which also loads the myAdd link set. Then, find the myAdd link set.

slreq.load("myAddRequirements");
ls = slreq.find("Type","LinkSet","Name","myAdd");

Find a link that matches the specified SID.

myLink = find(ls,"SID","3");

Find the links that have the specified revision.

myLinks = find(ls,"Revision","4")
myLinks=1×3 Link array with properties:
    Type
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedOn
    ModifiedBy
    Revision
    SID
    Comments

Find a link that matches the specified SID and revision.

myLink2 = find(ls,"SID","3","Revision","4");

This example shows how to find links that match the specified destination attribute.

Load the myAddRequirements requirement set, which also loads the myAdd link set. Then, find the myAdd link set.

slreq.load("myAddRequirements");
myLinkSet = slreq.find("Type","LinkSet","Name","myAdd");

Use the slreq.find function to find the links whose destination artifact is myAddRequirements.slreqx.

fp = which("myAddRequirements.slreqx");
myLinks = slreq.find("Type","Link","destination.artifact",fp);

Use the find method to find the links in the link set whose summary is Input u.

myLinks = find(myLinkSet,"destination.summary","Input u");

Tips

  • To search the loaded Requirements Toolbox objects, use the slreq.find function.

  • To search the children of a requirement, use the find method of slreq.Requirement

  • To search the children of a requirements set, use the find method of slreq.ReqSet.

  • To search the children of a reference, use the find method of slreq.Reference.

  • To search the children of a justification, use the find method of slreq.Justification.

Version History

Introduced in R2018a

expand all

See Also

Classes

Functions