How to handle visdiff for Simulink models per script?

13 views (last 30 days)
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:
  3 Comments
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.
mawa
mawa on 31 Aug 2022
@Manas Meena has anything happened regarding unsupported functions?

Sign in to comment.

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!