Comparing .mdl and .slx

19 views (last 30 days)
Tim Busfield
Tim Busfield on 28 Apr 2015
Commented: Tim Busfield on 29 Apr 2015
I have two Simulink models, one .mdl and one .slx. I want to confirm that the structure & functionality of the two models is the same, however the .mdl will not compile in R2014b - so I cannot use the 'Analysis > Compare Simulink XML Files' approach. Is there a way to convert the models to xml in 2010b and 2014b respectively and compare outside of Matlab (ie using diff tool) and how (dis)similar are the xml structures of .mdl and .slx models?

Accepted Answer

Christiaan
Christiaan on 29 Apr 2015
Dear Mr. Busfield,
As you may already know SLX is a compressed package that conforms to the Open Packaging Conventions (OPC) interoperability standard. SLX stores model information using Unicode® UTF-8 in XML and other international formats. Therefore in Simulink it is easy to export an slx file to an xml file.
What you may can try is to write the following in the MATLAB prompt:
>> save_system('model.mdl', 'model_xml.xml','ExportToXML', true);
A second possibility is that you save the mdl file in Simulink (2014 Version) to a slx file. In principle, if you upgrade an MDL file to SLX file format, the file contains the same information as the MDL file, and you always have a backup file. Now you could compare the xml files.
More information can be found in this documentation.
Kind regards, Christiaan

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!