| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Verification and Validation |
| Contents | Index |
| Learn more about Simulink Verification and Validation |
Selection-based linking is linking a Simulink object to a selected item in a requirements document. Using selection-based linking, the RMI creates a link from the object to the requirement text.
The following tutorial takes you through the steps to link a block in a Simulink model to text in a Microsoft Word document.
For this tutorial, create and save a Microsoft Word 2007 document, requirements.docx, with the content shown in the following graphic. Style the header lines "Transmission Requirements" and "Engine Requirements" as Heading 1.

Note The requirements document for this exercise is in Microsoft Word 2007 format. If you do not have Microsoft Word 2007, you can use earlier versions of the Microsoft Word software. |
Open a Simulink demo model. Create a link from a block in the model to the text you selected in the requirements document:
At the MATLAB prompt, type sf_car to open the model.
In requirements.docx, select the paragraph under "Engine Requirements".
Right-click the Engine block and select Add link to Word selection.
Verify the link from the Engine block by right-clicking the Engine block and selecting Requirements.
A shortened version of the requirements text appears at the top of the context menu.

Click the requirement text to navigate to that location in the requirements document.
Save the model as sf_car_linking.
The RMI inserts a bookmark into the requirements document when creating the link. Save the requirements document.
You can customize selection-based linking. From the Model Editor window, select Tools > Requirements > Settings. On the Selection-based linking tab, the following options are available.
| Selection-Based Linking Option | Description |
|---|---|
Document types | Specify the document types for which you want selection-based linking to be available. |
Document file reference | Specify how to store the requirements document. Valid options are:
For more information, see Resolving the Document Path. |
Modify documents to include links to models | Select this option to enable the RMI to insert navigation objects into the requirements document. By default, the RMI inserts only bookmarks (when needed) into the requirements document. |
Model file reference | Specify how to locate the model path from a requirements document. Valid options are:
For more information, see Resolving the Document Path. |
In the following step, you create a link from another Simulink object to another requirement in the requirements document that you created. Use document indexing instead of selection-based linking.
In the sf_car_linking model, right-click the transmission block and select Requirements > Edit/Add Links.
The Requirements dialog box for the Engine block opens.
In the Requirements: transmission dialog box, click New to add a new requirement.
In the Document type field, select Microsoft Word to search only for those file types.
Locate the requirements document, requirements.docx, and select Open.
The file path appears in the Document field.
Note For information about how the RMI resolves the path to the requirements document, see Resolving the Document Path. |
Click the Document Index tab to create an index of the requirements document so that you can easily access specific locations in the document.
Note After you click the Document Index tab, the document indexing begins immediately. You see the following status bar.
If you do not want the document index or if it takes too long to process the file, click Cancel. If you click Cancel, processing stops and the software creates a partial document index. You cannot resume the document indexing unless you restart your MATLAB session. |
From the automatically generated list of headings and bookmarks in the document, select Transmission Requirements.

Note The document index includes the bookmark Simulink_requirement_item_1 created during the selection-based linking tutorial in Linking from a Simulink Object to a Selected Item in a Requirements Document. |
Click Apply to create the link from the requirements document text to the Engine block and redisplay the Requirements tab.
(Optional) To provide additional details about the current requirement, on the Requirements tab, in the User tag field, enter additional, descriptive text.
To verify the link from the transmission block to the requirement, right-click the transmission block and select Requirements.
The name of the requirement in the new link is a submenu selection.
![]()
For the next two tutorials, create a requirements document in a Microsoft Excel spreadsheet with the following content and save it as requirements.xlsx.

Note The requirements document for this exercise is in Microsoft Excel 2007 format. If you do not have Microsoft Excel 2007, you can use earlier versions of the Microsoft Excel software. |
You can add or delete links to requirements for a selection of multiple Simulink or Stateflow objects. In this example, you modify the requirements document to add a third requirement, and link two objects in the model to the new requirement:
Open the Microsoft Excel requirements document (requirements.xlsx).
In the sf_car_linking model, select two objects together:
transmission
shift_logic
Right-click any of the blocks that you selected and then select Requirements > Add Links to All.
The Add requirements dialog box opens for those two blocks.
Browse to the Microsoft Excel requirements document and click Open.
Note For information about how the RMI resolves the path to the requirements document, see Resolving the Document Path. |
In the Location drop-down list, select Sheet range.
Next to the Location drop-down list, enter A1:A2 to specify the range of cells for the Shift Logic Requirements.
Click OK to close the Add requirements dialog box.
In the sf_car_linking model, verify that both the shift_logic Stateflow chart and the transmission block have a new requirement, Shift logic requirements.
The RMI can create a link from a Signal Builder block to a requirements document:
In the sf_car_linking model, double-click the User Inputs block.
The Signal Builder dialog box opens, displaying four groups of signals.
At the far-right end of the toolbar, click the Show
verification settings button
. You see a Requirements pane
in the Signal Builder dialog box.

Place your cursor in the window, right-click, and select Edit/Add Links.
The Requirements dialog box opens.
Click New. In the Description field, enter User input requirements.
Browse to the Microsoft Excel requirements document and click Open.
In the Location drop-down list, select Search text to link to specified text in the spreadsheet.
Next to the Location drop-down list, enter User Input Requirements.
Click Apply to create the link.
To verify that the RMI creates the link, in the Model Editor, select the User Inputs block, right-click, and select Requirements.
Save the sf_car_linking model.
Note Links that you create in this way associate requirements information with individual signal groups, not with the entire Signal Builder block. In this example, switch to a different tab to link a requirement to another signal group. |
When you browse and select a requirements document, the RMI optionally stores the location of the document with a fully specified absolute path. You can also enter a relative path for the document location. A relative path can be a partial path or no path at all. If you use a relative path, the document is not constrained to a single location in the file system. With a relative path, the RMI resolves the exact location of the requirements document in this order:
The software attempts to resolve the path relative to the current MATLAB folder.
If there is no path specification and the document is not in the current folder, the software uses the MATLAB search path to locate the file.
If the RMI cannot locate the document relative to the current folder or the MATLAB search path, the RMI resolves the path relative to the model file folder.
The following examples illustrate the procedure for locating a requirements document.
Current MATLAB folder | |
Model file | |
Document link | |
Documents searched for |
Current MATLAB folder | |
Model file | |
Requirements document | |
Documents searched for | C:\work\scratch\pid.html |
Current MATLAB folder | |
Model file | |
Requirements document | |
Documents searched for |
![]() | About Requirements Documents | Viewing Simulink Objects That Have Requirements Links | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |