slreq.refreshCustomizations
说明
slreq.refreshCustomizations
在 MATLAB® 路径中搜索 sl_customization.m
文件并注册文件中定义的需求类型和链接类型自定义。
注意
如果安装了 Simulink®,此函数的行为与 sl_refresh_customizations
(Simulink) 相同。如果未安装Simulink,此函数仅注册Requirements Toolbox™自定义并静默忽略其他自定义。
示例
使用 sl_customization
文件定义并注册自定义需求和链接类型
此示例显示如何使用 sl_customization
文件定义和注册自定义需求类型和自定义链接类型。
创建 sl_customization
文件
在 MATLAB® 中,选择主页选项卡,然后点击新建脚本。将此代码复制并粘贴到脚本中。
function sl_customization(cm) cObj = cm.SimulinkRequirementsCustomizer; end
选择编辑器选项卡,然后点击保存。将文件另存为 sl_customization.m
。
定义 Requirements Toolbox 自定义
使用 addCustomRequirementType
函数定义一个名为 Stakeholder
的自定义需求类型。将自定义需求类型定义为内置Functional
类型的子类型,然后为自定义需求类型提供描述。将此代码复制并粘贴到sl_customization
文件中。
addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,... "Stakeholder functional requirements");
使用 addCustomLinkType
函数将自定义链接类型定义为名为 Trace
的内置 Relate
类型的子类型。将前向和后向链接方向分别定义为Traces
和Traced from
,然后为自定义链接类型提供描述。将此代码复制并粘贴到 sl_customization
文件中,然后点击保存。
addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",... "Traced from","General purpose link type from requirement to other item.");
注册 Requirements Toolbox 自定义
更新后的 sl_customization
文件定义了需求类型和链接类型自定义。
type sl_customization
function sl_customization(cm) cObj = cm.SimulinkRequirementsCustomizer; addCustomRequirementType(cObj,"Stakeholder",slreq.custom.RequirementType.Functional,... "Stakeholder functional requirements"); addCustomLinkType(cObj,"Trace",slreq.custom.LinkType.Relate,"Traces",... "Traced from","General purpose link type from requirement to other item."); end
注册 Requirements Toolbox 自定义。
slreq.refreshCustomizations
在需求编辑器中查看自定义
在需求编辑器中打开basicReqSet
需求集。
slreq.open("basicReqSet");
在需求编辑器中,点击显示需求,然后选择索引为 1
的需求。在右侧窗格中的属性下,在类型菜单中,从列表中选择 Stakeholder
。
点击显示链接并选择 link #1
。在右侧窗格中的属性下,在类型菜单中,从列表中选择 Traces
。
版本历史记录
在 R2022a 中推出
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)