Compiled report generator script fails.

9 ビュー (過去 30 日間)
Michael
Michael 2025 年 1 月 23 日
コメント済み: Michael 2025 年 1 月 28 日
I am receiving an error in a compiled script for report generator.
Here is the script:
makeDOMCompilable();
import mlreportgen.report.*
import mlreportgen.dom.*
rpt = Report('Test','pdf');
%open(rpt);
% titlepage
%I = imread(img);
%imshow(I);
tp = TitlePage;
%location = pwd;
tp.Title = 'Just a Test';
tp.Image = which(strcat('duel.jpg'));
%tp.Author = Analyst();
tp.Publisher = 'Mike Fisher';
tp.PubDate = date();
tp.Subtitle = 'GTG';
add(rpt,tp);
add(rpt,LineBreak);
close(rpt);
rptview(rpt);
Runs fine in the command window. Compile it and run, get this error:
Error using mlreportgen.dom.Image
Invalid image type: .
Error in mlreportgen.report.TitlePage/getImageReporter
Error in mlreportgen.report.TitlePage/getImag
Error in mlreportgen.report.ReportForm/fillHole
Error in mlreportgen.report.TitlePage/processHole
Error in mlreportgen.report.ReportForm/fillForm
Error in mlreportgen.report.ReporterBase/getDocumentPart
Error in mlreportgen.report.ReporterBase/getImpl
Error in mlreportgen.report.internal.LockedForm.add
Error in mlreportgen.report.ReportBase/append
Error in mlreportgen.report.ReportBase/add
Error in JTest (line 28)

回答 (1 件)

Kojiro Saito
Kojiro Saito 2025 年 1 月 24 日
It seems that duel.jpg is not included in the compiled script, so tp.Image is not an image format then add(rpt,tp) gives an error.
You need to add duel.jpg in "Files required for your application to run" of Application Compiler or add "-a duel.jpg" option in mcc command.
  2 件のコメント
Michael
Michael 2025 年 1 月 28 日
That does not solve the problem. The report generator must be able to look at several different file folders and pick a particular image (all named the same) from a specific folder. I cannot compile the images with the application, they change.
Michael
Michael 2025 年 1 月 28 日
Further efforts produce not working when running the stand alone app, but launching Command Prompt and running from within Command Prompt does work.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by