Add Custom Attributes to Links
When you create a link set using Requirements Toolbox™, you can create custom attributes that apply to the links contained in the link set. Custom attributes extend the set of properties associated with your links.
Alternatively, you can customize your links by creating stereotypes that define custom link types and properties. For more information, see Define Custom Requirement and Link Types and Properties.
Define Custom Attributes for Link Sets
To define a custom attribute for a link set:
Open the Requirements Editor. At the MATLAB® command prompt, enter:
slreq.editor
Open a requirement set that contains requirement links, or create a new requirement set and create requirement links. For more information, see Create and Store Links.
Click Show Links.
Select the link set.
In the right pane, under Custom Attribute Registries, click Add to add a custom attribute to the link set.
The Custom Attribute Registration dialog box appears. Enter the name of your custom attribute in the Name field. Select the type from the Type drop-down menu. Enter a description of the custom attribute in the Description field.
Alternatively, you can programmatically add a custom attribute to a
link set by using addAttribute
.
Custom Attribute Types
There are four custom attribute types:
Edit
: Text box that accepts a character array. There is no default value.Checkbox
: Single check box that can be either checked or unchecked. The default value is unchecked.Combobox
: Drop-down menu with user-defined options.Unset
is always the first option in the drop-down menu and the default attribute value.DateTime
: Text box that only accepts adatetime
array. There is no default value. Seedatetime
for more information ondatetime
arrays.
Set Custom Attribute Values for Links
After you define custom attributes for a link set, you can set the custom attribute value for each link. Select the link in the Requirements Editor. In the right pane, under Custom Attributes, enter the desired value in the field.
Note
You can only set the custom attribute value for one link at a time.
You can also set the custom attribute value for a link programmatically by using
setAttribute
.
If you do not define a value for Checkbox
or
Combobox
type custom attributes for a link, the value will be set
to the default. For Checkbox
custom attributes, the default value is
defined for the link set in the right pane, under
Custom Attribute Registries. For Combobox
custom attributes, the default value is Unset
.
Edit Custom Attributes
After you define a custom attribute for a link set, you can make limited changes to the custom attribute. Select the link set in the Requirements Editor. In the right pane, under Custom Attribute Registries, select the custom attribute you want to edit and click Edit.
Alternatively, you can edit custom attributes programmatically by using updateAttribute
.
For custom attributes of any type, you can edit the name and
description. For Combobox
custom attributes, you can also edit the
value of each option in the drop-down menu, or add and remove options. If you remove an
option, the custom attribute value for links that previously had that value reset to the
default value, Unset
. Editing the value of multiple options at once
resets the custom attribute values of that attribute for
all links in the link set. However, you can edit the
value of a single option without resetting the custom attribute values. Additionally, if
you reorder the existing options without changing the value of
any of the options, the links' custom attribute values
do not reset.
After you set the custom attribute value for a link, you can change the value at any time by selecting the link in the Requirements Editor and setting the updated value in the right pane, under Custom Attributes.