Main Content

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

slreq.convertAnnotation

将注释转换为需求对象

说明

myReq = slreq.convertAnnotation(myAnnotation,myDestination) 将 Simulink® 或 Stateflow® 注释 myAnnotation 转换为需求 myReq 并将其存储在目标实体 myDestination 中。

myReq = slreq.convertAnnotation(myAnnotation,myDestination,Name,Value) 将 Simulink 或 Stateflow 注释 myAnnotation 转换为需求 myReq,并使用一个或多个 Name, Value 对参量指定的附加选项将其存储在目标实体 myDestination 中。

示例

Simulink 注释转换为需求

% Find all annotations in a Simulink model
allAnnotations = find_system('controller_Model', 'FindAll', ...
'on', 'type', 'annotation');

% Create a new requirement set
newReqSet = slreq.new('myNewReqSet');

% Convert one annotation into a requirement newReq
% and add it to newReqSet
newReq = slreq.convertAnnotation(allAnnotations(1), ...
newReqSet);

输入参数

全部折叠

要转换的注释,指定为 Simulink.Annotation 对象。

转换后的注释的目标实体,指定为 slreq.Requirementslreq.ReqSet 对象。

名称-值参数

将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN,其中 Name 是参量名称,Value 是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。

在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name 引起来

示例: 'CreateLinks', true

转换注释时创建链接的选项,指定为布尔值。

转换后保留注释的选项,指定为布尔值。

即使在注释中指定了回调函数,也可以指定注释转换的选项,指定为布尔值。

注释转换后显示需求标记的选项,指定为布尔值。

输出参量

全部折叠

转换后的注释,作为 slreq.Requirement 对象返回。

版本历史记录

在 R2018a 中推出