I have created a GUI where the final results are listed on a Word document that is created automatically by Matlab.
Therefore, I am using import mlreportgen.dom.*; code-line.
When I use it on Matlab (clicking Run button), it works ok and the Word document is created.
I have compiled the GUI by deploytool –> standalone application and I create the .exe file.
When I run the .exe it doesn't create the Word document. I have chased the error-source and I have seen that it fails at the code-line where it is written: moveToNextHole.
I have seen in other Q&A tags that I should write makeDOMCompilable() just before import mlreportgen.dom.*; in order to make DOM compilable.
However, it still doesn't work. (By the way, I am using Matlab 2016a)
Below I have attached part of my ReportGenerator code:
%———————————————————%
%function Report_StaticAnalysis
msgbox('Check 1: It enters generate_report')
makeDOMCompilable()
import mlreportgen.dom.*;
reportnumber = datestr(now,'yyyy mm dd (HH MM SS)'); Report_name= strcat('Report_StaticAnalysis_',reportnumber);
%% Title
doc = Document(Report_name,'docx', 'ReportTemplate');
msgbox('Check 2: Report_name created')
moveToNextHole(doc);
msgbox('Check 3: moveToNextHole is done')
textObj = Text(evalin('base', 'title'));
% The code continues but it is too long to attach all of it
%———————————————–%
As you can see, I have put some msgbox in order to see where it stops running. Check 1 and 2 work ok, but Check 3 is not created when running the .exe. Therefore moveToNextHole(doc) is failing.
Why is it failing? I am using the makeDOMCompilable() code-line. Any ideas?
Best Answer