Main Content

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

find

类: slreq.ReqSet
命名空间: slreq

在需求集查找具有匹配属性值的需求

语法

myReq = find(rs, 'PropertyName', 'PropertyValue')

说明

myReq = find(rs, 'PropertyName', 'PropertyValue') 在与 PropertyNamePropertyValue 匹配的属性指定的需求集rs 中查找并返回 slreq.Requirement 对象 myReq。属性名称匹配不区分大小写。

输入参数

全部展开

需求集,指定为 slreq.ReqSet 对象。

输出参量

全部展开

需求,作为 slreq.Requirement 对象返回。

示例

查找具有匹配属性值的需求

% Load a requirement set file
rs = slreq.load('C:\MATLAB\My_Requirements_Set_1.slreqx');

% Find all editable requirements in the requirement set
allReqs = find(rs, 'Type', 'Requirement');

% Find all referenced requirements in the requirement set
allRefs = find(rs, 'Type', 'Reference');

% Find all requirements with a certain ID
matchedReqs = find(rs, 'ID', 'R1.1');

使用正则表达式匹配查找需求

您可以使用波浪号 (~) 符号构建正则表达式搜索模式来搜索需求集的需求。

% Load a requirement set file
rs = slreq.load('C:\MATLAB\My_Requirements_Set_1.slreqx');

% Find all requirements that correspond to the controller
controllerReqs = find(rs, 'Type', 'Requirement', 'Summary', '~Controller(?i)\w*')

controllerReqs = 

  1×19 Requirement array with properties:

    Id
    Summary
    Keywords
    Description
    Rationale
    SID
    CreatedBy
    CreatedOn
    ModifiedBy
    ModifiedOn
    FileRevision
    Dirty
    Comments
有关构建正则表达式搜索模式的更多信息,请参阅 构建表达式的步骤

版本历史记录

在 R2018a 中推出

另请参阅

|