Customize Requirements with Custom Attributes
When you create a requirement set using Simulink® Requirements™, you can create custom attributes that apply to the requirements contained in the requirement set. Custom attributes extend the set of properties associated with your requirements.
Define Custom Attributes for Requirement Sets
To define a custom attribute for a requirement set:
Open the Requirements Editor. At the MATLAB® command prompt, enter:
Click Show Requirements.
Open an existing requirement set, or create a new one.
Select the requirement set.
In the Details pane, under Custom Attribute Registries, click Add to add a custom attribute to the requirement 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.
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.
Unsetis always the first option in the drop-down menu and the default attribute value.
DateTime: Text box that only accepts a
datetimearray. There is no default value. See
datetimefor more information on
Set Custom Attribute Values for Requirements
After you define custom attributes for a requirement set, you can set the custom attribute value for each requirement. Select the requirement in the Requirements Editor. In the Details pane, under Custom Attributes, enter the desired value in the field.
If you do not define a value for
Combobox type custom attributes for a requirement, the value will be set
to the default. For
Checkbox custom attributes, the default value is
defined in the Custom Attribute Registries pane for the requirement set.
Combobox custom attributes, the default value is
Edit Custom Attributes
After you define a custom attribute for a requirement set, you can make limited changes to the custom attribute. To make changes, select the requirement set in the Requirements Editor. In the Details pane, under Custom Attribute Registries, select the custom attribute you want to edit and click Edit.
For custom attributes of any type, you can edit the name and
Combobox custom attributes, you can also edit the
drop-down menu options. You can edit the value of each option in the drop-down menu (excluding
Unset), or add and remove options. If you edit the value of an option or
remove an option, then requirements that had been set to that option will be reset to the
After you set the custom attribute value for a requirement, you can change the value by selecting the requirement in the Requirements Editor and setting the updated value in the Custom Attributes pane.
Custom Attributes for Referenced Requirements
When importing requirements from an external file into Simulink
Requirements, if you select Allow updates from external source, the
requirements are imported as referenced requirements (
slreq.Reference objects). For more information, see Select an Import Mode.
Referenced requirements are read-only by default. Although you can add custom attributes to a requirement set that includes referenced requirements, you must unlock the requirement to add a custom attribute value. Select the referenced requirement and, in the Details pane, under Properties, click Unlock. Alternatively, you can unlock the referenced requirements by selecting the top import node and, in the Details pane, under Requirement Interchange, clicking Unlock all.
If you click Update in the Requirement Interchange pane, changes to your requirement set such as new custom attributes or new custom attribute values will be lost. Save or export your requirement set files before using Update. You can use Export in the Requirement Interchange pane to export a ReqIF™ file with new custom attributes.
Import Custom Attributes
When importing requirements from an external source, you can also import custom attributes that exist in the external source.
Import Custom Attributes from ReqIF
When importing requirements from a ReqIF file, you can map information to built-in properties and custom attributes. For more information, see Mapping ReqIF Attributes in Simulink Requirements.
Import Custom Attributes with Direct Import from IBM DOORS Next
When importing requirements using direct import from IBM® DOORS® Next®, custom attributes that are defined in DOORS Next are automatically imported to Simulink Requirements. For information about importing requirements from IBM DOORS Next using direct import, see Link and Trace Requirements with IBM DOORS Next.
Import Custom Attributes from Microsoft Excel
When importing requirements from a Microsoft® Excel® file, you can map predefined headers or a row of cells to built-in properties and custom attributes. See Import Options for Microsoft Excel Spreadsheets.
You can only set the custom attribute value for one requirement at a time.
If you copy a requirement and paste it within the same requirement set, the copied requirement retains the same custom attribute values as the original. If the requirement is pasted into a different requirement set, the copied requirement does not retain the custom attribute values.