updateAttribute
Class: slreq.LinkSet
Namespace: slreq
Update information for link set custom attribute
Syntax
updateAttribute(myLinkSet,atrb,Name,Value)
Description
updateAttribute(
updates the custom attribute specified by myLinkSet,atrb,Name,Value)atrb with properties specified
by the name-value pairs Name and Value in the link
set myLinkSet.
Input Arguments
Link set, specified as an slreq.LinkSet object.
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.'
Custom attribute description, specified as the comma-separated pair consisting of
'Description' and a character array.
Example: 'Description','My new description.'
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
This example shows how to update custom attribute information for a link set.
Load the crs_req requirement files, which describe a cruise control system. Find a link set in the files and assign it to a variable.
slreq.load('crs_req'); ls = slreq.find('Type','LinkSet');
Update an Edit Custom Attribute
Add an Edit custom attribute that has a description to the link set. Get the attribute information with inspectAttribute.
addAttribute(ls,'MyEditAttribute','Edit','Description', ... 'Original attribute.'); inspectAttribute(ls,'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(ls,'MyEditAttribute','Description', ... 'Updated attribute.'); inspectAttribute(ls,'MyEditAttribute')
ans = struct with fields:
name: 'MyEditAttribute'
type: Edit
description: 'Updated attribute.'
Update a Combobox Custom Attribute
Add a Combobox custom attribute with a list of options to the link set. Get the attribute information with inspectAttribute.
addAttribute(ls,'MyCombobox','Combobox','List',{'Unset','A','B','C'}); inspectAttribute(ls,'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(ls,'MyCombobox','List',{'Unset','1','2','3'}); inspectAttribute(ls,'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(ls,'MyCombobox','List',{'Unset','A1','B2','B3'}, ... 'Description','Updated attribute with new options.'); inspectAttribute(ls,'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 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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)