updateAttribute
Class: slreq.ReqSet
Namespace: slreq
Syntax
updateAttribute(rs,atrb,Name,Value)
Description
updateAttribute(
updates the custom attribute specified by rs
,atrb
,Name,Value
)atrb
with properties specified
by the name-value pairs Name
and Value
in the
requirement set rs
.
Input Arguments
rs
— Requirement set
slreq.ReqSet
object
Requirement set, specified as an slreq.ReqSet
object.
atrb
— Custom attribute name
character array
Custom attribute name, specified as a character array.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'Description','My new
description.'
Description
— Custom attribute description
character array
Custom attribute description, specified as the comma-separated pair consisting of
'Description'
and a character array.
Example: 'Description','My new description.'
List
— Combobox
list options
cell array
Combobox
list options, specified as the comma-separated pair
consisting of 'List'
and a cell array. The list of options is
valid only if 'Unset'
is the first entry.
'Unset'
indicates that the user hasn't chosen an option from
the combo box. If the list does not start with 'Unset'
, it will be
automatically appended as the first entry.
Example: 'List',{'Unset','A','B','C'}
Note
You can only use this name-value pair when the Type
property of the custom attribute that you're updating is
Combobox
.
Examples
Update Requirement Set Custom Attribute Information
This example shows how to update custom attribute information for a requirement set.
Load crs_req_func_spec
, which describes a cruise control system. Find a requirement set in the files and assign it to a variable.
slreq.load('crs_req_func_spec'); rs = slreq.find('Type','ReqSet');
Update an Edit
Custom Attribute
Add an Edit
custom attribute that has a description to the requirement set. Get the attribute information with inspectAttribute
.
addAttribute(rs,'MyEditAttribute','Edit','Description','Original attribute.') inspectAttribute(rs,'MyEditAttribute')
ans = struct with fields:
name: 'MyEditAttribute'
type: Edit
description: 'Original attribute.'
Update the custom attribute with a new description. Confirm the change by getting the attribute information with inspectAttribute
.
updateAttribute(rs,'MyEditAttribute','Description','Updated attribute.') inspectAttribute(rs,'MyEditAttribute')
ans = struct with fields:
name: 'MyEditAttribute'
type: Edit
description: 'Updated attribute.'
Update a Combobox
Custom Attribute
Add a Combobox
custom attribute that has a list of options to the requirement set. Get the attribute information with 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'}
Update the custom attribute with a new list of options. Confirm the change by getting the attribute information with 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'}
Update the custom attribute with a new list of options and a new description. Confirm the change by getting the attribute information with 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'}
Version History
Introduced in R2020b
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)