Main Content

本页采用了机器翻译。点击此处可查看英文原文。

slreq.find

查找需求、参考和链接集工件

说明

示例

myReqTbxObjects = slreq.find("Type",ObjectType) 返回已加载的 Requirements Toolbox™ 对象,其类型由 ObjectType 指定。

示例

myReqTbxObjects = slreq.find("Type",ObjectType,Name,Value) 返回已加载的 Requirements Toolbox 对象,其需求类型或链接类型由 NameValue 指定。

示例

对于 PropertyName 指定的属性,myReqTbxObjects = slreq.find("Type",ObjectType,PropertyName,PropertyValue) 返回已加载的 Requirements Toolbox 对象,其属性值等于 PropertyValue。该属性可以是内置属性、自定义属性或原型属性。

示例

myReqTbxObjects = slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) 返回已加载的 Requirements Toolbox 对象,其属性值 PropertyValue 满足 PropertyOperator 指定的属性的关系准则。

示例

myReqTbxObjects = slreq.find("Type",ObjectType,___,"-or",___) 返回已加载的、至少符合其中一个准则的Requirements Toolbox 对象。

示例

全部折叠

此示例显示如何查找需求。

加载需求集myAddRequirements

rs = slreq.load("myAddRequirements");

查找已加载的需求。

reqs = slreq.find("Type","Requirement")
reqs=1×4 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

此示例显示如何查找功能需求。

加载需求集myAddRequirements

rs = slreq.load("myAddRequirements");

查找已加载的功能需求。

reqs = slreq.find("Type","Requirement","ReqType","Functional")
reqs=1×4 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

此示例显示如何通过属性值查找需求。

加载需求集myAddRequirements

rs = slreq.load("myAddRequirements");

找到已加载的需求,其中 Index 设置为 2

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

此示例显示如何使用关系运算符通过属性值查找需求。

加载需求集myAddRequirements

rs = slreq.load("myAddRequirements");

查找 Index 大于 2 的已加载需求。

reqs = slreq.find("Type","Requirement","Index:>",2)
reqs=1×2 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

此示例显示如何使用多个准则按属性值查找需求。

加载需求集myAddRequirements

rs = slreq.load("myAddRequirements");

查找将 Index 设置为 24 的已加载需求。

req = slreq.find("Type","Requirement","Index",2,"-or","Index",4)
req=1×2 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

此示例显示如何查找与指定目标属性匹配的链接。

加载myAddRequirements需求集,它还会加载myAdd链接集。然后,找到myAdd链接集。

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

使用 slreq.find 函数查找目标工件为 myAddRequirements.slreqx 的链接。

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

使用 find 方法查找链接集中摘要为 Input u 的链接。

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

输入参数

全部折叠

Requirements Toolbox 对象类型,指定为:

  • "ReqSet"

  • "Requirement"

  • "Reference"

  • "Justification"

  • "LinkSet"

  • "Link"

Requirements Toolbox 对象属性名称,指定为字符串标量或字符向量。该字符串必须是以下类之一的自定义属性、原型属性或内置属性的名称:

如果将 ObjectType 指定为 "Link",则 PropertyName 可以是链接目标属性,指定为以下字符串之一:

  • "destination.domain"

  • "desintation.artifact"

  • "destination.id"

  • "destination.summary"

链接目标属性对应于destination方法输出的结构体字段。

Requirements Toolbox 对象属性值,指定为以下数据类型之一:

  • 字符串标量

  • 字符数组

  • boolean

  • datetime

  • single

  • double

  • int8

  • int16

  • int32

  • int64

  • uint8

  • uint16

  • uint32

  • uint64

  • enumeration

数据类型取决于内置属性、自定义属性或原型属性的类型。

要搜索正则表达式,请使用语法 slreq.find("Type",ObjectType,PropertyOperator,PropertyValue) 并在 PropertyOperator 输入中包含 regexp。将 PropertyValue 指定为包含正则表达式的字符串标量或字符向量。有关更多信息,请参阅 正则表达式

Requirements Toolbox 对象属性名称和关系运算符或正则表达式,指定为字符串标量或字符向量。此参量将属性名称和关系运算符(以冒号分隔)组合在单个字符串或字符向量中。例如,要指定名为 Index 的属性和名为 > 的操作符,则字符串为 "Index:>”。

属性名称必须是自定义属性、原型属性或下列类之一的内置属性的名称:

操作符必须是下列选项之一:

  • regexp

  • ==

  • ~=

  • >

  • >=

  • <

  • <=

有关关系运算符的更多信息,请参阅 MATLAB 运算符和特殊字符

使用 regexp 运算符搜索正则表达式。有关更多信息,请参阅 正则表达式

名称-值参数

将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。

在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name 引起来

示例: "ReqType","Functional"

需求类型,指定为 "Functional""Container""Informational"

示例: "ReqType","Functional"

数据类型: char | string

链接类型,指定为以下类型之一:

  • "Relate"

  • "Implement"

  • "Verify"

  • "Derive"

  • "Refine"

  • "Confirm"

示例: "LinkType","Relate"

数据类型: char | string

输出参量

全部折叠

Requirements Toolbox 对象,作为以下对象之一的数组返回:

提示

  • 要查找与指定属性匹配的申述的子项,请使用 slreq.Justificationfind 方法。

  • 要查找与指定属性匹配的需求的子项,请使用 slreq.Requirementfind 方法。

  • 要查找与指定属性匹配的引用需求的子项,请使用 slreq.Referencefind 方法。

  • 要查找与需求集的指定属性匹配的需求,请使用 slreq.ReqSet.find 方法

  • 要查找链接集中与指定属性匹配的链接,请使用 slreq.LinkSetfind 方法。

  • 要按目标属性查找链接,请将 ObjectType 指定为 "Link",并将 PropertyName 指定为链接目标属性,指定为以下字符串之一:

    • "destination.domain"

    • "desintation.artifact"

    • "destination.id"

    • "destination.summary"

    例如,要查找目标工件是名为 myAdd.slreqx 的需求集的链接,请输入:

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

版本历史记录

在 R2018a 中推出

全部展开