主要内容

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

find

类: slreq.Requirement
命名空间: slreq

查找满足父级需求的子级

语法

childReqs = find(req,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN)

说明

childReqs = find(req,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN) 查找并返回父需求 childReqs 的子需求 req,且该子需求与 PropertyNamePropertyValue 指定的属性相匹配。

输入参数

全部展开

需求,指定为 slreq.Requirement 对象。

需求属性名称,指定为字符向量。请参阅 slreq.Requirement属性 部分中的有效属性名称。

示例: 'Type','Keywords','SID'

需求属性值,指定为字符向量、字符数组、datetime 值、标量、logical 或结构体数组。数据类型取决于指定的 propertyName。请参阅 slreq.Requirement属性 部分中的有效属性值。

输出参量

全部展开

子项需求,以 slreq.Requirement 对象形式返回。

示例

全部展开

此示例显示如何查找与属性值匹配的子需求。

加载描述巡航控制系统的 crs_req_func_spec 需求文件,并将其分配给变量。查找索引为 4 的需求,因为该需求有子需求。

rs = slreq.load("crs_req_func_spec");
parentReq = find(rs,"Type","Requirement","Index","4");

查找在修订版 1 中修改的 parentReq 的子需求。

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

查找所有在修订版 parentReq 中被修改且属于 1 类型需求的 Functional 子需求。

childReqs2 = find(parentReq,"FileRevision",1,"Type","Functional")
childReqs2=1×10 Requirement array with properties:
    Type
    Id
    Summary
    Description
    Keywords
    Rationale
    CreatedOn
    CreatedBy
    ModifiedBy
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

提示

  • 要搜索已加载的 Requirements Toolbox 对象,请使用 slreq.find 函数。

  • 要搜索需求集的子项,请使用 slreq.ReqSetfind 方法。

  • 要搜索链接集的子项,请使用 slreq.LinkSetfind 方法。

  • 要搜索引用的子项,请使用 slreq.Referencefind 方法。

  • 要搜索某个申述的子项,请使用 slreq.Justificationfind 方法。

版本历史记录

在 R2018a 中推出