Contenuto principale

Export, Print, and Save Model Comparison Results

R2026b

You can save model comparison results as reports or workspace variables. If you have not yet run a comparison analysis, see Select Models to Compare.

To save your comparison results in a report, in the Comparison toolstrip, select Publish and choose the report format: HTML, Word, PDF or PDF/A. PDF/A comparison reports are not supported on Linux®.

Alternatively, you can publish a comparison report to a file using the visdiff function.

If you apply filters to the comparison results, the saved report contains only filtered results.

The report also shows side by side screenshots of the modified models. Starting in R2023a, you can disable screenshots in comparison reports. Before you publish the comparison results, in the Command Window, enter these commands.

s = settings().comparisons.slx.DisplayReportScreenshots;
s.TemporaryValue = false;

To export the comparison results to the MATLAB® base workspace, in the Comparison toolstrip, select Publish > Save to Workspace and specify the variable name.

Saving the model comparison results as a workspace variable creates a ModelDiffResults object in the workspace. The ModelDiffResults object contains information about the comparison, including file names, filters applied, and hierarchical nodes that differ between the two files.

To create a ModelDiffResults object at the command line without opening the Comparison Tool, enter this command.

results = visdiff(modelname_A,modelname_B)

Saving the model comparison results as a workspace variable creates an xmlcomp.Edits object in the workspace. The xmlcomp.Edits object contains information about the comparison, including file names, filters applied, and hierarchical nodes that differ between the two files.

To create an xmlcomp.Edits object at the command line without opening the Comparison Tool, enter this command.

edits = slxmlcomp.compare(modelname_A,modelname_B)

Property of xmlcomp.EditsDescription
FiltersArray of filters — Every filter has two properties, Name and Value.
LeftFileNameFile name of left model.
LeftRootxmlcomp.Node object that represents the root of the left tree.
RightFileNameFile name of right model.
RightRootxmlcomp.Node object that represents the root of the right tree.
TimeSavedTime when results are exported to the workspace.
VersionMathWorks® release-specific version number of xmlcomp.Edits object.
Property of xmlcomp.NodeDescription
ChildrenArray of xmlcomp.Node references to child nodes, if any.
Edited

Boolean — If Edited = true, then the node is either inserted, deleted, or part of a modified matched pair.

The Comparison Tool reports modified matched pairs when nodes move in the hierarchy or when the change between two nodes is intrinsic and not parameter-driven.

NameName of node.
ParametersArray of parameters — Every parameters has two properties, Name and Value.
Parentxmlcomp.Node reference to parent node, if any.
PartnerIf matched, Partner is an xmlcomp.Node reference to the matched partner node in the other tree. Otherwise, Partner is empty [].

See Also

|

Topics