Save 2 Figures from GUI

Hi, I have a GUI with two figures with the tags plot1 and plot2. I would like to save these plots in two separate fig-files using the current filename [filename = get(handles.filename,'String');].
I have tried the copyobj-routine, but have difficulties with the correct syntax. Can anyone help me? Thanks a lot.

回答 (4 件)

Julia
Julia 2014 年 11 月 13 日

0 投票

Hi,
I use the saveas() command to save figures.
saveas(h,'filename','format')
Frank
Frank 2014 年 11 月 13 日

0 投票

Thank you for the reply. That works fine, I also figured out my original attempt using copyobj and hgsave.
I now stumbled across another problem: I need the extracted figures to be flexible (i.e. they need to adjust, when I change the size of the window). At the same time, when I first open the new figure file, I would like the plots to be the exact same size as the figures in GUI. How do I do that?
I am currently using this command and it keeps the plots in the new window dynamic/flexible. However, upon first opening the plots have a different size that the plots from the GUI.
pos = get(gcf, 'DefaultAxesPosition'); set(gca, 'Units', 'normalized', 'Position', pos)
Thank you!!
Frank
Frank 2014 年 11 月 14 日

0 投票

Hi, thanks for the link. That was very helpful. Still, I am not sure about how to adjust the size properly. Where does the GUI save the size of the plots/axes? And how do I implement that variable so that the new figure has the exact same size?
Thank you!!

カテゴリ

ヘルプ センター および File ExchangeGraphics Object Properties についてさらに検索

質問済み:

2014 年 11 月 13 日

回答済み:

2014 年 11 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by