Save 2 Figures from GUI

1 visualizzazione (ultimi 30 giorni)
Frank
Frank il 13 Nov 2014
Risposto: Frank il 14 Nov 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.

Risposte (4)

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

Frank
Frank il 13 Nov 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 il 13 Nov 2014

Frank
Frank il 14 Nov 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!!

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by