Main Content

Work with Requirements in the Requirements Editor

Requirements Toolbox™ enables you to author, organize, and edit requirements in the Requirements Editor. When working in a Simulink® model, you can use the Requirements Perspective to visualize the links between requirements and the parts of a model. Using an integrated environment simplifies linking requirements to the parts of your model that implement them.

This integrated environment has other advantages. For more information, see Introduction to Requirements Toolbox.

Author Requirements in MATLAB

In Requirements Toolbox, you organize your requirements in groups called requirement sets. In each requirement set, you can create additional levels of hierarchy if you need to further describe a requirement's details.

In this tutorial, you use the Requirements Editor to create a requirement set, organize related requirements, and add requirements to the set.

Suppose that you are writing requirements for a controller model of an automobile cruise control system. You develop these requirements using your company’s numbering standard (R1, R2, and so on).

ID and DescriptionRationale
R1: The maximum input throttle is 100%The maximum value of the throttle from the acceleration pedal can be no greater than 100%.
R2: Cruise control has a speed operation rangeCruise control has a minimum and maximum operating speed.
R2.1: The vehicle speed must be at least 40 km/hThe speed of the vehicle must be at least 40 km/h for the cruise control system to engage.
R2.2: The vehicle speed cannot be greater than 100 km/hThe maximum operational speed of the cruise control system for the vehicle is 100 km/h.

These requirements capture functionality modeled in a model called crs_controller.

  1. Open the project that includes the model and supporting files. At the MATLAB® command prompt, enter:

  2. Load the requirement set crs_req. At the command prompt, enter:

  3. Open the Requirements Editor. In the Apps tab, click Requirements Editor.

    The Requirements Editor displays the requirements in the Requirements Browser arranged by requirement set. The crs_controller model has two requirement sets: crs_req_func_spec and crs_req.

    Requirements Editor with Show Requirements selected. The crs_req_func_spec and crs_req requirement sets are collapsed.

  4. Add a requirement set in the Requirements Browser. From the Requirements Editor toolbar, click New Requirement Set.

  5. Save the requirement sets to external files. Save your requirement set to a writable location and name it cruise_control_reqset.slreqx.

  6. Add a requirement to your requirement set by selecting the requirement set and clicking Add Requirement.

  7. In the Details pane, under Properties, enter the details for the requirement. Enter the details for the requirement:

    • Custom ID: R1

    • Summary: Max input throttle %

    • Description: The maximum input throttle is 100%.

    If you do not specify a custom ID, the Requirements Editor numbers requirements in order. Custom IDs enable you to use your company standards for labeling requirements and to set the numeric order. (Custom IDs cannot contain a # character.) You can also use an ID to help locate a requirement when searching. Keywords aid in searching for a requirement.

  8. Create the requirement R2. Click Add Requirement. Enter the details for the requirement:

    • Custom ID: R2

    • Summary: Cruise control speed operation range

    • Description: Cruise control has a minimum and maximum operating speed.

  9. Create child requirements for R2 by selecting R2 and clicking Add Requirement > Add Child Requirement. Enter the details for the requirement:

    • Custom ID: R2.1

    • Summary: Minimum vehicle speed

    • Description: The speed of the vehicle must be at least 40 km/h for the cruise control system to engage.

    Open requirement sets in the Requirements Editor. The cruise_control_reqset is expanded and includes three requirements.

    Repeat this step to add other child requirements to R2.

You can rearrange the hierarchy by using Promote Requirement or Demote Requirement.

Author and Edit Requirements Content by Using Microsoft Word

To author and edit the Description and Rationale fields of your requirements, open Microsoft® Word from within the Requirements Editor or the Requirements Perspective View.


This functionality is available only on Microsoft Windows® platforms.

Using Microsoft Word to edit rich text requirements enables you to:

  • Spell-check requirements content.

  • Resize images.

  • Insert and edit equations.

  • Insert and edit tables.

On the Edit field toolbar, in either the Description or Rationale fields, click the icon. Save the changes to your requirements content within Microsoft Word to see them reflected in Requirements Toolbox.

When you use Microsoft Word to edit requirements content, you cannot edit requirements in the built-in editor.

Customize Requirements Browser View

You can view or hide columns in the Requirements Editor when you click Columns > Select Attributes. Add, remove, and reorder attribute columns in the Column Selector. The view configuration is saved across sessions. You can export view settings to a MAT-file by using the slreq.exportViewSettings function and import them by using the slreq.importViewSettings function. You can reset view configurations by using the slreq.resetViewSettings function.

Filter Requirements Content

You can search requirements content by clicking Search. You can find specific requirements within loaded requirement sets based on requirement attributes and descriptions.

Specify Filter Text Strings — As you enter text in the Search text box, the Requirements Browser performs a dynamic search and displays the results. The search operation applies only to attributes you choose to display in the Requirements Browser.

The text strings you enter must be consistent with the guidelines described in the following sections.

Case Sensitivity — By default, the Requirements Browser ignores case as it filters.

If you want the Requirements Browser to respect case sensitivity, put that text string in quotation marks.

Specify Attributes and Attribute Values — To restrict the filtering to requirements with a specific attribute, type the attribute name, followed by a colon. The Requirements Browser displays only the requirements that have that attribute.

To filter for requirements for which a specific attribute has a specific value, type the attribute name, followed by a colon (:), then the value. For example, to filter the contents to display only the requirements where the Summary attribute has a value that includes Aircraft, enter Summary: Aircraft (alternatively, you could put the whole string in quotation marks to enforce case sensitivity).

Wildcards and MATLAB Expressions Are Not Supported — The Requirements Browser does not recognize wildcard characters, such as *. For example, searching fuel* returns no results, even if requirements contain the text string fuel.

Also, if you specify a MATLAB expression in the Search text box, the Requirements Browser interprets that string as literal text, not as a MATLAB expression.

Link Blocks and Requirements

You can track requirements implementation by linking requirements to model elements that implement the requirements. Linking also enables change notification, so that you can review and act on changes to requirements or models.

In this tutorial, link requirements to a model by using the model requirements perspective. Visual elements highlight links between requirements and blocks.

  1. Open the Requirements Definition for a Cruise Control Model project. At the MATLAB command prompt, enter:


  2. Open crs_controller from the models folder. At the MATLAB command prompt, enter:

  3. In the model canvas, click the perspectives control in the lower-right corner.

    Close up of the lower-right corner of the Simulink canvas. The mouse points to the perspectives button, and the tooltip is displayed.

  4. Open the requirements perspective by clicking the Requirements icon.

    Close up of the lower-right corner of the Simulink canvas, showin the mouse pointing to the Show Perspectives view button

    The Requirements Browser appears at the bottom of the model canvas. When you select a requirement, the Property Inspector displays the requirement's properties.

  5. Link a requirement to a model element:

    1. In the Requirements Browser, search for Enable Switch Detection.

    2. Link to the enbl Inport block by clicking and dragging the requirement to the block. An annotation template appears.

    3. Place the requirement annotation by clicking on the canvas. Create a link without an annotation by clicking outside the canvas.

    Close up of a Simulink block with an Implements link to a requirement named Enable Switch Detection

  6. The block displays a link badge. To display information about the requirement, click the badge and select Show.

    Simulink block after the requirements badge was clicked, showing the requirement and the Show button

    Clicking Show displays the requirement ID, requirement summary, and link type. For information on link types, see Requirement Links.

    Simulink showing the annotation on the canvas

    • To see the requirement description, double-click the annotation.

    • To edit the requirement, right-click the annotation and select Select in Requirements Browser. Edit the requirement properties in the Property Inspector.

  7. Exit the requirements perspective. Click the perspectives control and click the requirements icon.

    Lower-right corner of the canvas showing the mouse pointing to the Requirements Perspective to exit the perspective

Work with Simulink Annotations

Convert Simulink Annotations to Requirements.  You can convert the annotations in your Simulink models to requirements by using the context menu in the Requirements Perspective View and by using the API. See slreq.convertAnnotation for more information on converting annotations to requirements by using the API.

To convert annotations to requirements by using the context menu in the Requirements Perspective View:

  1. Open the Simulink model and enter the Requirements Perspective View.

  2. Select a requirement set from the Requirements Browser. This is the destination requirement set for the new requirement.

  3. Right click the annotation you want to convert to a requirement and click Convert to Requirement.

  4. The annotation is converted to a requirement and is linked to the system or subsystem at which the annotation was present.

Link Requirements to Simulink Annotations.  Use the Requirements Perspective View to link requirements to text and area annotations on the Simulink Editor. To create a link, select a requirement and drag it onto the annotation. If you link requirements to an area annotation, a badge appears on the annotation to show that the link was created. You see badges only in the Requirements Perspective View. To see more information about the requirement, click the badge and select Show.

See Also

Related Topics