主要内容

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

find

类: slreq.Reference
命名空间: slreq

查找父级引用需求的子级

语法

childRefs = find(ref,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN)

说明

childRefs = find(ref,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN) 查找并返回父引用需求 ref 的所有子引用需求 childRefs,这些子引用需求需满足由 PropertyNamePropertyValue 指定的属性。

输入参数

全部展开

引用的需求,指定为 slreq.Reference 对象。

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

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

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

输出参量

全部展开

子引用需求,以 slreq.Reference 对象形式返回。

示例

全部展开

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

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

rs = slreq.load("crs_req");
parentRef = find(rs,"Type","Reference","Index","3")
parentRef = 
  Reference with properties:

              Id: 'Functional Requirements'
        CustomId: 'Functional Requirements'
        Artifact: 'crs_req.docx'
      ArtifactId: '?Functional Requirements'
          Domain: 'linktype_rmi_word'
       UpdatedOn: 02-Feb-2018 13:23:13
       CreatedOn: NaT
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'Functional Requirements'
     Description: '<div class=WordSection1>↵↵<div style='border:none;border-bottom:solid #595959 1.0pt;padding:0in 0in 1.0pt 0in'>↵↵<h1 style='margin-left:0in;text-indent:0in'>        Functional Requirements</h1>↵↵</div>↵↵</div>'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 9
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0×0 struct]
           Index: '3'

查找在修订版 parentRef 中修改的 1 的子引用需求。

childRefs1 = find(parentRef,"FileRevision",1)
childRefs1=1×18 Reference array with properties:
    Id
    CustomId
    Artifact
    ArtifactId
    Domain
    UpdatedOn
    CreatedOn
    CreatedBy
    ModifiedBy
    IsLocked
    Summary
    Description
    Rationale
    Keywords
    Type
    IndexEnabled
    IndexNumber
    SID
    FileRevision
    ModifiedOn
    Dirty
    Comments
    Index

查找在修订版 parentRef 中修改且 SID 等于 112 子引用需求。

childRefs2 = find(parentRef,"FileRevision",1,"SID",12)
childRefs2 = 
  Reference with properties:

              Id: 'Activating cruise control'
        CustomId: 'Activating cruise control'
        Artifact: 'crs_req.docx'
      ArtifactId: '?Activating cruise control'
          Domain: 'linktype_rmi_word'
       UpdatedOn: 02-Feb-2018 13:23:13
       CreatedOn: NaT
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'Activating cruise control'
     Description: '<div class=WordSection1>↵↵<h2 style='margin-left:0in;text-indent:0in'>Activating cruise control</h2>↵↵<p class=MsoNormal><span style='line-height:107%'>Cruise control is activated when↵the following conditions are met:</span></p>↵↵</div>'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 12
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0×0 struct]
           Index: '3.3'

提示

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

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

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

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

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

版本历史记录

在 R2018a 中推出