updateAttribute
类: slreq.ReqSet
命名空间: slreq
语法
updateAttribute(rs,atrb,Name,Value)
说明
updateAttribute(
需求集rs
,atrb
,Name,Value
)rs
中的名称-值对 Name
和 Value
指定的属性来更新 atrb
指定的自定义属性。
输入参数
rs
— 需求集
slreq.ReqSet
对象
需求集,指定为 slreq.ReqSet
对象。
atrb
— 自定义属性名称
字符数组
自定义属性名称,指定为字符数组。
名称-值参数
将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量后,但参量对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: 'Description','My new description.'
Description
— 自定义属性说明
字符数组
自定义属性描述,指定为由 'Description'
和字符数组组成的逗号分隔的对。
示例: 'Description','My new description.'
List
— Combobox
列表选项
元胞数组
Combobox
列表选项,指定为由 'List'
和元胞数组组成的逗号分隔的对。仅当 'Unset'
是第一个条目时,选项列表才有效。'Unset'
表示用户尚未从组合框中选择选项。如果列表不是以 'Unset'
开头,它将自动附加为第一个条目。
示例: 'List',{'Unset','A','B','C'}
注意
仅当您要更新的自定义属性的 Type
属性为 Combobox
时,才可以使用此名称-值对。
示例
更新需求集自定义属性信息
此示例显示如何更新需求集的自定义属性信息。
加载crs_req_func_spec
,它描述了巡航控制系统。在文件中找到一组需求集并将其分配给变量。
slreq.load('crs_req_func_spec'); rs = slreq.find('Type','ReqSet');
更新 Edit
自定义属性
添加具有对需求集描述的Edit
自定义属性。使用 inspectAttribute
获取属性信息。
addAttribute(rs,'MyEditAttribute','Edit','Description','Original attribute.') inspectAttribute(rs,'MyEditAttribute')
ans = struct with fields:
name: 'MyEditAttribute'
type: Edit
description: 'Original attribute.'
使用新的描述更新自定义属性。通过使用 inspectAttribute
获取属性信息来确认更改。
updateAttribute(rs,'MyEditAttribute','Description','Updated attribute.') inspectAttribute(rs,'MyEditAttribute')
ans = struct with fields:
name: 'MyEditAttribute'
type: Edit
description: 'Updated attribute.'
更新 Combobox
自定义属性
向需求集添加包含选项列表的 Combobox
自定义属性。使用 inspectAttribute
获取属性信息。
addAttribute(rs,'MyCombobox','Combobox','List',{'Unset','A','B','C'}) inspectAttribute(rs,'MyCombobox')
ans = struct with fields:
name: 'MyCombobox'
type: Combobox
description: ''
list: {'Unset' 'A' 'B' 'C'}
使用新的选项列表更新自定义属性。通过使用 inspectAttribute
获取属性信息来确认更改。
updateAttribute(rs,'MyCombobox','List',{'Unset','1','2','3'}) inspectAttribute(rs,'MyCombobox')
ans = struct with fields:
name: 'MyCombobox'
type: Combobox
description: ''
list: {'Unset' '1' '2' '3'}
使用新的选项列表和新的描述更新自定义属性。通过使用 inspectAttribute
获取属性信息来确认更改。
updateAttribute(rs,'MyCombobox','List',{'Unset','A1','B2','B3'},'Description',... 'Updated attribute with new options.') inspectAttribute(rs,'MyCombobox')
ans = struct with fields:
name: 'MyCombobox'
type: Combobox
description: 'Updated attribute with new options.'
list: {'Unset' 'A1' 'B2' 'B3'}
清理
清除打开的需求集并关闭打开的模型而不保存更改。
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)