copy
类: slreq.Justification
命名空间: slreq
语法
tf = copy(just1,location,just2)
说明
复制申述tf
= copy(just1
,location
,just2
)just1
并将其粘贴到申述just2
之下、之前或之后,具体取决于 location
指定的位置。如果执行了复制和粘贴,该函数将返回 1
。
注意
如果您复制一个申述并将其粘贴到同一个需求集内,则复制的申述将保留与原始申述相同的自定义属性值。如果将申述粘贴到不同的需求集,则复制的申述不会保留自定义属性值。
输入参数
just1
— 要复制是申述
slreq.Justification
对象
复制的申述,指定为 slreq.Justification
对象。
location
— 申述粘贴位置
'under'
| 'before'
| 'after'
粘贴位置,指定为 'under'
、'before'
或 'after'
。
just2
— 将原始申述粘贴在附近
slreq.Justification
对象
将原始申述粘贴在附近的申述,指定为 slreq.Justification
对象。
输出参量
tf
— 粘贴成功状态
0
| 1
粘贴成功状态,以数据类型为 logical
的 0
或 1
返回。
示例
复制并粘贴申述
此示例显示如何复制一个申述并将其粘贴到另一个申述之下、之前或之后。
加载描述巡航控制系统的crs_req_justs
需求文件,并将其分配给变量。根据索引找出两个申述。第一个申述将被复制并粘贴到与第二个申述相关的位置。
rs = slreq.load('crs_req_justs'); jt1 = find(rs,'Type','Justification','Index','5.1'); jt2 = find(rs,'Type','Justification','Index','5.2');
粘贴在申述之下
将第一个申述jt1
复制并粘贴到第二个申述jt2
下方。第一个申述成为 jt2
的最后一个子申述,您可以通过查找 jt2
的子申述并比较最后一个子申述和 jt1
的摘要来验证这一点。
tf = copy(jt1,'under',jt2);
childJusts = children(jt2);
lastChild = childJusts(numel(childJusts));
lastChild.Summary
ans = 'Non-functional requirement'
jt1.Summary
ans = 'Non-functional requirement'
在申述之前粘贴
将第一个申述jt1
复制并粘贴到第二个申述jt2
之前。通过检查索引和摘要,确认申述已粘贴在jt2
之前。jt2
的旧索引为 5.2
。粘贴的申述的索引应为 5.2
,而 jt2
的索引应为 5.3
。
tf = copy(jt1,'before',jt2); pastedJust1 = find(rs,'Type','Justification','Index','5.2'); pastedJust1.Summary
ans = 'Non-functional requirement'
jt2.Index
ans = '5.3'
粘贴在申述之后
将第一个申述jt1
复制并粘贴到第二个申述jt2
之后。通过检查索引确认申述已粘贴在jt2
之后。jt2
的索引是 5.3
,并且不应改变,这意味着粘贴的申述的索引应该是 5.4
。
tf = copy(jt1,'after',jt2); pastedJust2 = find(rs,'Type','Justification','Index','5.4'); pastedJust2.Summary
ans = 'Non-functional requirement'
jt2.Index
ans = '5.3'
清理
清除打开的需求集和链接集,并关闭打开的模型而不保存更改。
slreq.clear;
bdclose all;
版本历史记录
在 R2020b 中推出
另请参阅
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)