Save axes plot as '.fig' in a GUI

30 ビュー (過去 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 Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by