Main Content

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

find

类: slreq.Reference
命名空间: slreq

查找父级引用需求的子级

语法

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

说明

childRefs = find(ref,'PropertyName1',PropertyValue1,...,'PropertyNameN',PropertyValueN) 查找并返回与 PropertyNamePropertyValue 指定的属性匹配的父引用需求ref 的子引用需求 childRefs

输入参数

全部展开

引用的需求,指定为 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>...'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 9
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0x0 struct]
           Index: '3'

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

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

查找在修订版 1 中修改且 SID 等于 12 的所有子引用需求parentRef

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>...'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 12
    FileRevision: 1
      ModifiedOn: 03-Aug-2017 17:34:56
           Dirty: 0
        Comments: [0x0 struct]
           Index: '3.3'

清理

清除打开的需求集和链接集,并关闭打开的模型而不保存更改。

slreq.clear;
bdclose all;

版本历史记录

在 R2018a 中推出