Save figure from GUI with axes and colorbar

1 回表示 (過去 30 日間)
Steven
Steven 2012 年 4 月 19 日
I am trying to save a figure from a GUI I made. However, I have tried several methods using code from this forum. Unfortunately, I can't get any of them to keep the axes, colorbar, and colormap of the original plot. Here is the code I am using:
[filename,pathname] = uiputfile('default','Save your GUI settings');
if pathname == 0 %if the user pressed cancelled, then we exit this callback
return
end
saveDataName = fullfile(pathname,filename);
F=getframe(handles.axes1);
figure();
image(F.cdata);
saveas(gcf,saveDataName,'fig')
thank you for your help!

採用された回答

Image Analyst
Image Analyst 2012 年 4 月 19 日
  2 件のコメント
Steven
Steven 2012 年 4 月 20 日
I had come across this file, but I haven't been able to get it to work with my pushbutton. I know this is kinda cheesy, but I found a workaround. I just plot in a new figure window. From there, the user can use "File" > "Save As" to save in their desired format.
Image Analyst
Image Analyst 2012 年 4 月 20 日
I don't know why. It works fine for me, and thousands of others (it's the most downloaded File Exchange file of all). You can show your code if you want us to fix it. Maybe you got the filename wrong or something. Or contact Oliver and ask him.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by