Main Content

slreq.find

Find requirement, reference, and link set artifacts

Description

example

myReqTbxObjects = slreq.find("Type",ObjectType) returns the loaded Requirements Toolbox™ objects of the type specified by ObjectType.

example

myReqTbxObjects = slreq.find("Type",ObjectType,Name,Value) returns the loaded Requirements Toolbox objects with the requirement type or link type specified by Name and Value.

example

myReqTbxObjects = slreq.find("Type",ObjectType,PropertyName,PropertyValue) returns the loaded Requirements Toolbox objects with the property value equal to PropertyValue for the property specified by PropertyName. The property can be a built-in property, custom attribute, or stereotype property.

example

myReqTbxObjects = slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) returns the loaded Requirements Toolbox objects whose property value, PropertyValue, meets the relational criteria for the property specified by PropertyOperator.

example

myReqTbxObjects = slreq.find("Type",ObjectType,___,"-or",___) returns the loaded Requirements Toolbox objects that match at least one of the criteria.

Examples

collapse all

This example shows how to find requirements.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirements.

reqs = slreq.find("Type","Requirement")
reqs=1×4 object
  1×4 Requirement array with properties:

    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to find functional requirements.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded functional requirements.

reqs = slreq.find("Type","Requirement","ReqType","Functional")
reqs=1×4 object
  1×4 Requirement array with properties:

    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirement with Index set to 2.

req = slreq.find("Type","Requirement","Index",2);

This example shows how to use relational operators to find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirements with Index greater than 2.

reqs = slreq.find("Type","Requirement","Index:>",2)
reqs=1×2 object
  1×2 Requirement array with properties:

    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

This example shows how to use multiple criteria find requirements by property value.

Load the requirement set myAddRequirements.

rs = slreq.load("myAddRequirements");

Find the loaded requirement with Index set to 2 or 4.

req = slreq.find("Type","Requirement","Index",2,"-or","Index",4)
req=1×2 object
  1×2 Requirement array with properties:

    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

Input Arguments

collapse all

Requirements Toolbox object type, specified as:

  • "ReqSet"

  • "Requirement"

  • "Reference"

  • "Justification"

  • "LinkSet"

  • "Link"

Requirements Toolbox object property name, specified as a string scalar or character vector. The string must be the name of a custom attribute, stereotype property, or built-in property of one of these classes:

Requirements Toolbox object property value, specified as one of these data types:

  • String scalar

  • Character array

  • boolean

  • datetime

  • single

  • double

  • int8

  • int16

  • int32

  • int64

  • uint8

  • uint16

  • uint32

  • uint64

  • enumeration

The data type depends on the type of the built-in property, custom attribute, or stereotype property.

To search for a regular expression, use the syntax slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) and include regexp in the PropertyOperator input. Specify PropertyValue as a string scalar or a character vector that includes a regular expression. For more information, see Regular Expressions.

Requirements Toolbox object property name and relational operator or regular expression, specified as a string scalar or a character vector. This argument combines the property name and a relational operator, separated by a colon, in a single string or character vector. For example, to specify a property called Index and the operator >, the string is "Index:>".

The property name must be the name of a custom attribute, stereotype property, or a built-in property of one of these classes:

The operator must be one of these options:

  • regexp

  • ==

  • ~=

  • >

  • >=

  • <

  • <=

For more information about relational operators, see MATLAB Operators and Special Characters.

Use the regexp operator to search for a regular expression. For more information, see Regular Expressions.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: "ReqType","Functional"

Requirement type, specified as "Functional", "Container", or "Informational".

Example: "ReqType","Functional"

Data Types: char | string

Link type, specified as one of these types:

  • "Relate"

  • "Implement"

  • "Verify"

  • "Derive"

  • "Refine"

  • "Confirm"

Example: "LinkType","Relate"

Data Types: char | string

Output Arguments

collapse all

Requirements Toolbox objects, returned as an array of one of these objects:

Version History

Introduced in R2018a