필터 지우기
필터 지우기

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