Saving a Figure from inside a GUI

2 ビュー (過去 30 日間)
Rhys
Rhys 2013 年 6 月 14 日
Hi all!
I have been designing a few GUIs to make some data analysis easier. At the end process however I want to be able to save the created plot (and legend) with a push button. I have been looking over past questions and have seen a few ways to approach the problem. My current method of saving the plot is as follows
cd('F:\JLAB\Gui_output')
picname=input('Enter Name for Image: ','s')
saveas(handles.ax, picname, 'jpg')
cd(handles.CF)
The problem with this is that I take the whole GUI window instead of just the plot. The two other methods I have seen are the export_fig function and the copyobj method. With the export_fig function I cannot figure out how to tell it to take only the part that I want. With the copyobj method (copy the plot to a figure window and save it there) I cannot figure out how to properly use the function.
Additional info: When I created the axes I defined them with
handles.ax=axes('Outerposition',[.25, 0,0.8,0.8]);
Cheers, Rhys

採用された回答

Image Analyst
Image Analyst 2013 年 6 月 14 日
With export_fig(), you can pass it the axes handle on your GUI if you want to save only the axes. Is that what you meant by "take only the part that I want"? Did you try to pass it the axes handles instead of the figure handle?
  5 件のコメント
Image Analyst
Image Analyst 2013 年 6 月 15 日
I don't have your data so it's hard for me to reproduce.
Rhys
Rhys 2013 年 6 月 15 日
Well it worked when I tried it outside of my program so I will just keep playing around with it. Thanks for your help, it is much appreciated!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by