Save axes plot as '.fig' in a GUI

조회 수: 29 (최근 30일)
Manuel
Manuel 2013년 9월 9일
댓글: loghman 2018년 2월 4일
I have a GUI in which one an axes is located with a plot and I would like to save this axes as '.fig' file. I have tried with :
[FileName,PathName] = uiputfile;
saveDataName = fullfile(PathName,FileName);
axes(handles.Graph1_axes);
saveas(gca, saveDataName, 'fig');
But this commands save all the GUI interface as '.fig'. Any help will be welcome.
Thanks in advance!

채택된 답변

Jan
Jan 2013년 9월 9일
The FIG format contains the complete figure (as the name says already). If you want to save a single axes only and definitely want the FIG format, you can copy the axes to a new figure:
Fig1 = figure;
AxesH = axes;
plot(1:10, rand(10,10));
Fig2 = figure;
copyobj(AxesH, Fig2);
hgsave(Fig2, 'myFigure.fig');
  댓글 수: 1
Manuel
Manuel 2013년 9월 10일
편집: Manuel 2013년 9월 10일
Everything works! Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2013년 9월 9일
You can't directly save just the axes. Instead, use export_fig with the cropping option
  댓글 수: 5
loghman
loghman 2018년 2월 4일
copyobj doesn't work for axes with multiple coordinated system. what should i do?
loghman
loghman 2018년 2월 4일
copyobj doesn't work for axes with multiple coordinated system. what should i do?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by