Save 2 Figures from GUI

2 次查看(过去 30 天)
Frank
Frank 2014-11-13
回答: Frank 2014-11-14
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
Hi,
I use the saveas() command to save figures.
saveas(h,'filename','format')

Frank
Frank 2014-11-13
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!!

Stalin Samuel
Stalin Samuel 2014-11-13

Frank
Frank 2014-11-14
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!!

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by