Save 2 Figures from GUI

1 visualización (últimos 30 días)
Frank
Frank el 13 de Nov. de 2014
Respondida: Frank el 14 de Nov. de 2014
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.

Respuestas (4)

Julia
Julia el 13 de Nov. de 2014
Hi,
I use the saveas() command to save figures.
saveas(h,'filename','format')

Frank
Frank el 13 de Nov. de 2014
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 el 13 de Nov. de 2014

Frank
Frank el 14 de Nov. de 2014
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!!

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by