Main Content

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:

  1. Open the Requirements Editor. At the MATLAB® command prompt, enter:

    slreq.editor

  2. From the View menu, select Requirements.

  3. Open an existing requirement set, or create a new one.

  4. Select the requirement set.

  5. In the right pane, under Custom Attribute Registries, click Add to add a custom attribute to the requirement set.

  6. 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. Optionally, 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. Unset is always the first option in the drop-down menu and the default attribute value.

  • DateTime: Text box that only accepts a datetime array. There is no default value. See datetime for more information on datetime arrays.

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 right pane, under Custom Attributes, enter the desired value in the field.

If you do not define a value for Checkbox or 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. For Combobox custom attributes, the default value is always Unset.

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 right pane, under Custom Attributes Registries, select the custom attribute you want to edit and click Edit.

For custom attributes of any type, you can edit the name and description. For 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 any requirements that had been set to that option will be reset to the default value, Unset.

After you set the custom attribute value for a requirement, you can change the value at any time 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).

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 right pane, under Properties, click Unlock. Alternatively, you can unlock all referenced requirements by selecting the top import node and, in the right 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. See Create and Edit Attribute Mappings.

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. See Link with Requirements in 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.

Limitations

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.

Related Topics