remove
类: slreq.Reference
命名空间: slreq
删除引用需求
语法
count = remove(topRef)
count = remove(ref)
说明
删除导入节点 count
= remove(topRef
)topRef
下的所有后代引用需求以及导入节点本身。此函数返回已删除的引用需求的数量。
删除引用需求 count
= remove(ref
)ref
及其后代引用需求。此函数返回已删除的引用需求的数量。您只能在 PostImportFcn
回调中使用此语法。
输入参数
topRef
— 导入节点
slreq.Reference
对象
导入节点,指定为 slreq.Reference
对象。
ref
— 引用的需求
slreq.Reference
对象
引用的需求,指定为 slreq.Reference
对象。
输出参量
count
— 删除了引用需求计数
双精度值
删除的引用需求的数量,以双精度形式返回。
示例
从需求集中删除导入节点
加载名为 myReqSet
的需求集文件。
rs = slreq.load("myReqSet");
获取导入节点的句柄。
topRef = children(rs);
删除导入节点及其后代需求。
count = remove(topRef)
count = 46
删除 PostImportFcn
回调中的引用需求
此示例显示如何在 PostImportFcn
回调中删除导入的引用需求。
使用slreq.import
将 ReqIF™ 文件 mySpec.reqif
导入 Requirements Toolbox™。将导入的需求集myReqSet
,将脚本myPreImportScript2
注册为PreImportFcn
,将脚本removePostImport
注册为PostImportFcn
回调,供导入时使用。返回需求集的句柄。
[~,~,rs] = slreq.import("mySpec.reqif",ReqSet="myReqSet", ... preImportFcn="myPreImportScript2",postImportFcn="removePostImport");
脚本myPreImportScript2
使用slreq.getCurrentImportOptions
来获取导入选项,然后指定导入期间要使用的属性映射文件。
type myPreImportScript2.m
importOptions = slreq.getCurrentImportOptions; importOptions.MappingFile = "myMappingFile2.xml";
映射文件 myMappingFile2.xml
将 ReqIF 文件中的这些属性映射到 Requirements Toolbox 中的这些属性:
ReqSum
到Summary
Desc
到Description
ID
到Custom ID
脚本 myPostImportScript
使用 slreq.getCurrentObject
来获取导入节点的句柄,获取导入节点所属的需求集,然后查找并删除将 Summary
设置为 Requirement 3
的引用需求。
type removePostImport.m
topRef = slreq.getCurrentObject; rs = reqSet(topRef); ref = find(rs,Type="Reference",Summary="Requirement 3"); count = remove(ref);
版本历史记录
在 R2019a 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)