How do I display a figure from another section again?

12 ビュー (過去 30 日間)
Mareike Fischer
Mareike Fischer 2021 年 11 月 17 日
コメント済み: Mareike Fischer 2021 年 11 月 24 日
Hi!
I gernerated a figure in an early section. In the next sections I calculate some values and store those in a table.
In the last section want to display the figure and the table in the output of my live script. But I don't know how to call up again the figure. Gcf only shows the properties.
My acutal goal is to publish that last section as a pdf to have a report of my results (figure & table)
Thanks in advance

採用された回答

Alamanda Ponappa Poovaya
Alamanda Ponappa Poovaya 2021 年 11 月 24 日
Hi,
Essentailly, you want to display a figure which you had previously created in a different section again. You can use the savefig and openfig functions to do so. Refer to the code snippet below
%section 1
x = linspace(0,10);
y = sin(x);
plot(x,y)
title('Sine Wave')
xlabel('x ranges from 0 to 10')
ylabel('y = sin(x)')
savefig('SineWave.fig')
%section 2
openfig('SineWave.fig');
Ensure you don't forget the semicolon after openfig because it would otherwise show the figure properties;
Refer to the documetation below
  1 件のコメント
Mareike Fischer
Mareike Fischer 2021 年 11 月 24 日
Thank you very much!
In the meantime I startet using the report generator, however your answer might be helpful for other users.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by