Main Content

Compare and Merge Requirement Sets Using Comparison Tool

This example shows you how to use the Comparison tool to analyze the comparison results for different types of properties by publishing a comparison report. It also shows you how to merge the requirement sets and save the result in a target file.

Compare Requirement Sets

The example uses two requirement sets. The crs_req_func_spec_01 and crs_req_func_spec_02 files contain the original and changed requirements sets, respectively.

To compare the two requirements sets, in the current folder pane of MATLAB®, select the two files. Right-click either file and select Compare Selected Files/Folders. Alternatively, use the visdiff function to compare the two sets by typing this command in the MATLAB command prompt.


Understand the Results

By default, the tool highlights the changed requirements. The tool differentiates between different types of changes using colors. To change the colors, on the Environment tab on the MATLAB® toolstrip, click Preferences, and then click Comparison.

The view in the Comparison tool consists of two main parts.

  • The top pane displays the requirement sets in a hierarchical manner.

  • The bottom pane contains a name-value table with the names and values of specific properties or key parameters of the selected requirement.

Use the arrow button in the table to move the table to its corresponding requirement in the hierarchy.


  • When you click a modified requirement on either side, the name-value columns show modification details such as the username of the person who modified the requirement, the date on which they modified it, and the revision number.

  • When you click a custom attribute in a requirement set, you can view the changes to the attribute. For example, the requirement set crs_req_func_spec_02 was modified with the Customization Required? attribute set to true.


  • When you click the Description parameter in the requirements tree, you can view the original and changed description of the selected requirement.


Stepping Through Differences

Use the Next and Previous navigation buttons on the Navigate tab of the toolstrip to navigate between groups of changes in the requirement sets. If the item you select on the left has a match, the tool selects it on the right. Use the Swap Sides button to swap the view. Linked Scrolling is enabled by default so that you can scroll through the requirement sets on both sides at the same time. If you clear the Linked Scrolling parameter, you can scroll through requirement sets on the left pane or the right pane independently.

Highlight Results

To control highlighting in requirement sets, on the Highlight tab, select or clear Always Highlight. If you select Always Highlight, the tool shows the corresponding requirements in the Requirements Editor app each time you select an entry in the comparison tree.

You can click the Highlight Now button to highlight a selected requirement at any time in Requirements Editor. For example, if you select requirement number #67 (Maximum Throttle Value) from the crs_req_func_spec_01.slreqx file, and click Highlight Now, the requirement opens in Requirements Editor.

Filter Results

The Show Only Changed option on the Filter tab is always enabled by default. Clear this option to view both changed and unchanged requirements.


Publish Results

You can publish the comparison results in a comparison report. The report shows only the changes. You can publish the report in HTML, Word, or PDF formats. To publish the report, on the Comparison tab, click Publish and select the format. For more information, see Publish and Save Printable Report of Comparison Results. Alternatively, you can publish the report using the visdiff command.

Merge Mode

You can merge the changes from two requirements sets by clicking the Merge Mode button on the toolstrip of the Comparison tool.


You can navigate between the changes and the panes to select a value by using the radio buttons. By default, the right pane is selected. You can override this selection.


The merge creates a third file, Target, which can contain changes from either the crs_req_func_spec_01 or the crs_req_func_spec_02 file. You can exit Merge Mode by either accepting or rejecting the changes.

To save the merge results to a local folder, complete these steps.

  1. Click Save Result to save the merged file. The Input File Name dialog box appears.

  2. Specify a name for the result file with .slreqx or .slmx (for link set files) extension in the dialog and click OK. This action saves the results to the local folder.

To discard merge mode and return to Comparison tab, click Return to Comparison.

Merge Tips

You can merge the attributes only after you have merged the corresponding attribute registry.

See Also


Related Topics