Print figure into report

8 ビュー (過去 30 日間)
Mihir Tasgaonkar
Mihir Tasgaonkar 2022 年 7 月 5 日
コメント済み: Adam Danz 2022 年 7 月 11 日
Hi,
I'm trying to design an app that will run a few simulations and output the results in the form of a PDF. I've managed to sort out all other issues, but to plot my graphs into the report, I'm using the following method. (I went through many methods from MATLAB Central, and this is the one that worked and so I went forward with it.) The issue I'm encountering is line #9 pops up a figure and plots the graph onto it, before printing it into the report. And since I'm plotting close to 12 different graphs, this can become annoying for the user of the app. Are there any workarounds for this?
for kk =1:5
if app.test_selected==2
plot(app.x.(sprintf('SR%d',kk)).time,app.x.(sprintf('SR%d',kk)).velocity);
hold on;
elseif app.test_selected==3
plot(app.y.(sprintf('SR%d',kk)).time,app.y.(sprintf('SR%d',kk)).velocity);
hold on;
end
fig17=Figure();
fig18=Image(getSnapshotImage(fig17,AccGradeTestReport));
end
hold off;
add(Chapter2,fig18)
  2 件のコメント
Adam Danz
Adam Danz 2022 年 7 月 5 日
What is Image?
Do you need to generate the figure in line 9?
Mihir Tasgaonkar
Mihir Tasgaonkar 2022 年 7 月 11 日
I actually don't need to generate a figure window. I just need a way to print the figure into the report.

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

回答 (1 件)

Yatharth
Yatharth 2022 年 7 月 6 日
Hey! You can refer to this similar solution
  2 件のコメント
Mihir Tasgaonkar
Mihir Tasgaonkar 2022 年 7 月 11 日
set('Visible','off') actually doesn't work with Report Generator Figures.
Adam Danz
Adam Danz 2022 年 7 月 11 日
The figure needs to be generated before it can be embedded into the report. However, it could be generated with visibility set to off as was recommended below in the answers and then you could set visibility back on, if needed, before doing the report generation. I believe that's what @yatharth was getting at.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by