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

조회 수: 20 (최근 30일)
Newthon
Newthon 2023년 8월 1일
댓글: Newthon 2023년 8월 23일
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.

답변 (1개)

Ashutosh
Ashutosh 2023년 8월 21일
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
Newthon
Newthon 2023년 8월 23일
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.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by