MATLAB Answers

How can you programmatically save a comparison, created through the use of, to an HTML file without the use of the Matlab GUI.

3 views (last 30 days)
Dan Peterson
Dan Peterson on 14 Apr 2016
Commented: Marius Grigore on 8 Jan 2020
I'm currently trying to create an automated script to compare two model files. To compare the two model files I'm using the, modelname_B) function. When I do this Matlab opens up a comparison window that lists the contents of both model files. On that opened 'model_A vs model_B' window, I can click the 'Save As' button and save the comparison as an HTML file. I would like to know how to achieve this save functionality purely through Matlab script.


Sign in to comment.

Answers (1)

Anish Mitra
Anish Mitra on 18 Apr 2016
Try using it with an output argument (in R2016a) :
>> Edits =,modelname_B);
This then saves the results in an Edits object, and does not open up the comparison window.
Hope this helps,


Dan Peterson
Dan Peterson on 18 Apr 2016
Hi Anish,
Thank you for answering. I'm glad to hear that the comparison can be done without the need for a GUI. However, what I'm really after is a way to save a report of the differences in the same way that Matlab's GUI allows you to do so. Specifically, as one of three outputs:
  1. HTML
  2. Word
  3. Basic HTML
Marius Grigore
Marius Grigore on 8 Jan 2020
htmlString =, model2, 'html');
fh = fopen('report.html', 'w');
fprintf(fh, '%s', htmlString);

Sign in to comment.