How to handle visdiff for Simulink models per script?

18 views (last 30 days)
Hannes Siegl
Hannes Siegl on 23 Sep 2020
Commented: Manas Meena on 1 Oct 2020
I want to call the compare tool for Simulink per script, do a diff with a filter applied and store the output to the workspace in order to do some statistics.
comp_bat = visdiff('Mod1', 'Mod2')
The return value of comp is of class SimulinkModelComparison (methods: delete, filter, publish).
comp_bat =
SimulinkModelComparison with properties:
Left: 'Mod1.slx'
Right: 'Mod2.slx'
I can publish that to html or docx, but there is neither an option for publish to workspace (as it already is?) nor to define a filter.
If I run the comparison in the GUI, there is the possibility to set the filters, and to do the diff, and to publish to workspace.
However, the workspace variable is of class Edits (methods: none) now.
comp_gui =
Edits with properties:
Filters: [1×3 struct]
LeftFileName: 'Mod1.slx'
LeftRoot: [1×1 xmlcomp.Node]
RightFileName: 'Mod2.slx'
RightRoot: [1×1 xmlcomp.Node]
TimeSaved: '23-Sep-2020 15:43:34'
Version: '2.0'
The data which I want to evaluate is stored in LeftRoot and RightRoot.
So basically, I need to define the filter, set it in SimulinkModelComparison class and transform it somehow to Edits class.

Accepted Answer

Manas Meena
Manas Meena on 1 Oct 2020
In my understanding you want to edit the filters using visdiff , publish the results and export the results to the workspace.
For changing the filters via visdiff you may do the following :
comparison = visdiff(modelname1,modelname2);
filter(comparison, 'unfiltered');
Supported filters are: 'unfiltered' – removes all filtering from the comparison, or 'default' – default filtering strategy for comparisons.
Then you can use the publish function to view the results as an HTML file
To export results to the workspace and to learn more about the xmlcomp.Edits object refer to the following link:
For examples about Simulink Model Comparison you can refer to this link:
Manas Meena
Manas Meena on 1 Oct 2020
This functionality is not currently supported, I have heard that this issue is known and the concerned parties may be investigating further.

Sign in to comment.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by