Search code examples
matlabsimulink

Save Simulink model as XML file


I have a simulink model with me, and I need to generate an XML file from this model for the purpose of comparison.

I tried the following list of commands -

>> model = 'simple_model_1'; % simple_model_1 is the name of the model
>> open_system(model); % model must be in the current folder or matlab path
>> save_system(model, 'simple_model_1.xml', 'ExportToXML', true);

But I'm getting the following error: Warning: The 'ExportToXML' option is no longer supported and will be removed in a future release.

I am working with MATLAB 2018a. Please let me know if there is any way to generate an XML file from a model with this release of MATLAB.


Solution

  • The correct way to do model comparison is to use the model comparison tool. The corresponding command-line function is visdiff. The model comparison tool operates directly onto the *.slx files, there's no need to export to XML (this is done internally by the tool).