Error with compiled app designer app using report generator toolbox.
Big picture, I am using app designer to write data processing apps for the laboratory where I work. The apps use base Matlab (v 2022b) and report generator to create data sheets for our reports. I am attempting to use Matlab Compiler to compile these into standalone desktop apps that I can distribute to my group. The apps run fine in the Matlab environment, but all encounter an error when trying to create a report sheet in the compiled version.
An excerpt from the code is shown below. The error occurs at some point during the execution of this code in the compiled app. As a side question, is it possible to see an error log in the compiled app (similar to how errors would be shown in the command window while working in the Matlab environment)?
I suspect that the error is occuring when the program tries to find the template path in the compiled version or when the document command is executed. All the template files are bundled with the compiled app installer.
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
%user prompt to enter name of generated report file
prompt = {‘Enter File Name:’};
dlgtitle = ‘Input’;
dims = [1 35];
definput = {”};
Filename = inputdlg(prompt,dlgtitle,dims,definput);
Filename = string(Filename);
%Locate template file and generate full path
whoAmI = mfilename(‘fullpath’);
[fullpath, ~, ~] = fileparts(whoAmI);
template = fullfile(fullpath,’Templates’,’SwellC_Template_New.dotx’);
% I suspect this is the line where the code is encountering an
% error.
D = Document(Filename,’docx’, template);
%There is more code in the block below to finish populating the
%template, but this is the general format.
open(D)
moveToNextHole(D);
append(D, app.ProjectEditField.Value);
moveToNextHole(D);
append(D, app.FeatureEditField.Value);
moveToNextHole(D);
append(D, app.IndexEditField.Value);
moveToNextHole(D);
append(D, app.BoreholeEditField.Value);
moveToNextHole(D);
%…
close(D);
f = msgbox("Report Generation Complete");Big picture, I am using app designer to write data processing apps for the laboratory where I work. The apps use base Matlab (v 2022b) and report generator to create data sheets for our reports. I am attempting to use Matlab Compiler to compile these into standalone desktop apps that I can distribute to my group. The apps run fine in the Matlab environment, but all encounter an error when trying to create a report sheet in the compiled version.
An excerpt from the code is shown below. The error occurs at some point during the execution of this code in the compiled app. As a side question, is it possible to see an error log in the compiled app (similar to how errors would be shown in the command window while working in the Matlab environment)?
I suspect that the error is occuring when the program tries to find the template path in the compiled version or when the document command is executed. All the template files are bundled with the compiled app installer.
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
%user prompt to enter name of generated report file
prompt = {‘Enter File Name:’};
dlgtitle = ‘Input’;
dims = [1 35];
definput = {”};
Filename = inputdlg(prompt,dlgtitle,dims,definput);
Filename = string(Filename);
%Locate template file and generate full path
whoAmI = mfilename(‘fullpath’);
[fullpath, ~, ~] = fileparts(whoAmI);
template = fullfile(fullpath,’Templates’,’SwellC_Template_New.dotx’);
% I suspect this is the line where the code is encountering an
% error.
D = Document(Filename,’docx’, template);
%There is more code in the block below to finish populating the
%template, but this is the general format.
open(D)
moveToNextHole(D);
append(D, app.ProjectEditField.Value);
moveToNextHole(D);
append(D, app.FeatureEditField.Value);
moveToNextHole(D);
append(D, app.IndexEditField.Value);
moveToNextHole(D);
append(D, app.BoreholeEditField.Value);
moveToNextHole(D);
%…
close(D);
f = msgbox("Report Generation Complete"); Big picture, I am using app designer to write data processing apps for the laboratory where I work. The apps use base Matlab (v 2022b) and report generator to create data sheets for our reports. I am attempting to use Matlab Compiler to compile these into standalone desktop apps that I can distribute to my group. The apps run fine in the Matlab environment, but all encounter an error when trying to create a report sheet in the compiled version.
An excerpt from the code is shown below. The error occurs at some point during the execution of this code in the compiled app. As a side question, is it possible to see an error log in the compiled app (similar to how errors would be shown in the command window while working in the Matlab environment)?
I suspect that the error is occuring when the program tries to find the template path in the compiled version or when the document command is executed. All the template files are bundled with the compiled app installer.
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
%user prompt to enter name of generated report file
prompt = {‘Enter File Name:’};
dlgtitle = ‘Input’;
dims = [1 35];
definput = {”};
Filename = inputdlg(prompt,dlgtitle,dims,definput);
Filename = string(Filename);
%Locate template file and generate full path
whoAmI = mfilename(‘fullpath’);
[fullpath, ~, ~] = fileparts(whoAmI);
template = fullfile(fullpath,’Templates’,’SwellC_Template_New.dotx’);
% I suspect this is the line where the code is encountering an
% error.
D = Document(Filename,’docx’, template);
%There is more code in the block below to finish populating the
%template, but this is the general format.
open(D)
moveToNextHole(D);
append(D, app.ProjectEditField.Value);
moveToNextHole(D);
append(D, app.FeatureEditField.Value);
moveToNextHole(D);
append(D, app.IndexEditField.Value);
moveToNextHole(D);
append(D, app.BoreholeEditField.Value);
moveToNextHole(D);
%…
close(D);
f = msgbox("Report Generation Complete"); app designer, report generator, compiler MATLAB Answers — New Questions