updateAttribute
类: slreq.ReqSet
命名空间: slreq
更新需求集自定义属性的信息
语法
updateAttribute(rs,atrb,Name,Value)
说明
updateAttribute(
需求集 rs
,atrb
,Name,Value
)atrb
中的名称-值对 Name
和 Value
指定的属性来更新 rs
指定的自定义属性。
输入参数
需求集,指定为 slreq.ReqSet
对象。
自定义属性名称,指定为字符数组。
名称-值参数
将可选的参量对组指定为 Name1=Value1,...,NameN=ValueN
,其中 Name
是参量名称,Value
是对应的值。名称-值参量必须出现在其他参量之后,但参量对组的顺序无关紧要。
在 R2021a 之前,使用逗号分隔每个名称和值,并用引号将 Name
引起来。
示例: 'Description','My new description.'
自定义属性描述,指定为由 'Description'
和字符数组组成的逗号分隔的对。
示例: 'Description','My new description.'
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'}
版本历史记录
在 R2020b 中推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)