主要内容

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

verify

验证需求集的 ReqIF 导出选项

自 R2023a 起

    说明

    status = verify(myExportOptions,reqContent) 验证 ReqIF™ 导出选项、myExportOptions,用于 reqContent 指定的需求集、需求或引用的需求。

    示例

    [status,rs] = verify(myExportOptions,reqContent) 返回该需求的需求集,或者返回 reqContent 指定的引用需求。

    示例

    示例

    全部折叠

    此示例展示如何创建 ReqIF 导出选项、获取可用属性和自定义属性、指定要导出的属性和属性,以及验证生成的导出选项。

    打开 ShortestPath 工程。

    openProject("ShortestPath");

    加载 shortest_path_func_reqs 需求集。

    rs = slreq.open("shortest_path_func_reqs");

    创建导出选项

    创建一个导出选项对象,将输出文件指定为 shortest_path_func_reqif.reqif,导出链接,并使用通用导出映射。

    myExportOptions = slreq.export.ExportOptions( ...
        OutputFile="shortest_path_func_reqif.reqif", ...
        IncludeLinks=true,Template="Generic")
    myExportOptions = 
      ExportOptions with properties:
    
          OutputFile: "shortest_path_func_reqif.reqif"
            Template: "Generic"
        IncludeLinks: 1
                View: ''
          Attributes: {}
         MappingFile: ''
        TemplateFile: ''
    
    

    指定要导出的属性

    使用 getFilterableAttributes 函数获取要导出的可用属性。

    attributes = getFilterableAttributes( ...
        myExportOptions,rs)
    attributes = 1×11 cell
        {'Summary'}    {'Type'}    {'Keywords'}    {'CreatedOn'}    {'CreatedBy'}    {'ModifiedOn'}    {'ModifiedBy'}    {'Revision'}    {'Description'}    {'Rationale'}    {'Priority'}
    
    

    通过设置 Summary 导出选项属性的值,仅导出 DescriptionPriority 属性以及 Attributes 自定义属性。

    myExportOptions.Attributes = ["Summary", ...
        "Description","Priority"]
    myExportOptions = 
      ExportOptions with properties:
    
          OutputFile: "shortest_path_func_reqif.reqif"
            Template: "Generic"
        IncludeLinks: 1
                View: ''
          Attributes: ["Summary"    "Description"    "Priority"]
         MappingFile: ''
        TemplateFile: ''
    
    

    验证导出选项和导出需求

    验证 shortest_path_func_reqs 需求集的导出选项对象。

    status = verify(myExportOptions,rs)
    status = logical
       1
    
    

    将需求集导出至 ReqIF 文件。

    dir = slreq.export(rs,myExportOptions)
    dir = 
    'shortest_path_func_reqif.reqif'
    

    此示例显示如何验证单个需求的导出选项对象并返回该需求的需求集。

    打开 ShortestPath 工程。

    openProject("ShortestPath");

    加载 shortest_path_func_reqs 需求集。

    rs = slreq.load("shortest_path_func_reqs");

    通过摘要 Functional behavior 获取需求句柄。

    req = find(rs,Summary="Functional behavior");

    创建一个导出选项对象,将输出文件指定为 shortest_path_func_reqif.reqif,导出链接,并使用通用导出映射。

    myExportOptions = slreq.export.ExportOptions(OutputFile= ...
        "shortest_path_func_reqif.reqif",IncludeLinks=true, ...
        Template="Generic")
    myExportOptions = 
      ExportOptions with properties:
    
          OutputFile: "shortest_path_func_reqif.reqif"
            Template: "Generic"
        IncludeLinks: 1
                View: ''
          Attributes: {}
         MappingFile: ''
        TemplateFile: ''
    
    

    验证需求的导出选项对象。返回需求所属的需求集。

    [status,rs] = verify(myExportOptions,req);

    输入参数

    全部折叠

    导出选项,指定为 ExportOptions 对象。

    导出的需求,指定为字符串标量、字符向量、slreq.ReqSet 对象、slreq.Reference 对象或 slreq.Requirement 对象。使用字符串标量或字符向量指定需求集的文件名。

    输出参量

    全部折叠

    验证成功状态,以数据类型为 01logical 返回。

    数据类型: logical

    需求或引用需求所属的需求集,以 slreq.ReqSet 对象形式返回。

    版本历史记录

    在 R2023a 中推出