How to compare sldd files and publish a HMTL report using Matlab script?

21 views (last 30 days)
I'm making a Matlab script to automatically compare sldd files and generate an HTML report.
I can compare .slx, .m, etc. files using the visdiff function and publish a report using the publish function but I can't do the same for sldd files.
compare = visdiff('File1.sldd', 'File2.sldd')
Error using visdiff
Unable to compare 'C:\basic\File1.sldd' and 'C:\basic\File2.sldd' without opening the Comparison Tool.
From Help:
"comparison=visdiff(___) compares two model files and returns a comparison object containing the differences between the two files. This syntax does not open the Comparison Tool and is only supported for comparing Simulink models. name1 and name2 must be model files. Use the comparison object to manipulate the comparison at the command line, for example by applying filters and publishing comparison reports."
Is there any alternative?
I really appreciate any help.

Answers (1)

Ashutosh
Ashutosh on 21 Aug 2023
The "visdiff" function in MATLAB is designed to visually compare files using the MATLAB Comparison Tool, and it is primarily intended for text-based files like MATLAB code or Simulink models. It is not directly supported for comparing ".sldd" files, which are Simulink Data Dictionaries. The function "visdiff " requires the Comparison Tool to be opened, which does not apply to Simulink Data Dictionary files.
The alternative approach is to Export the Simulink data dictionary data in form of the ".mat" file and then apply the "visdiff" function to compare these ".mat" files.
These links can help to understand the above approach:
  1 Comment
Newthon
Newthon on 23 Aug 2023
Thanks but unfortunately that doesn't solve my problem. As I said, I need to export a report in HTML with the difference between the 2 dictionaries automatically, using the command line. With .slx files I achieve this by assigning the result of the visdiff command to a variable
compare = visdiff('File1.slx', 'File2.slx')
and then using the publish function. With .m files I can also do this however not with .mat files and when I export .sldd to .mat, it does not export enumerated data types, so this alternative (https://in.mathworks.com/help/simulink/ug/import-and-export-dictionary-data.html) doesn't help me. I just can't understand why I can generate report from .slx files using the Comparison Tool and clicking on Export and also through the command line with the visdiff and publish functions and for .sldd files I can only generate reports just using the Comparison Tool and clicking on Export but not through from the command line.

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!