I need GUI Save As button for an image in a figure please.

3 ビュー (過去 30 日間)
Quick Click
Quick Click 2011 年 6 月 15 日
Hi,
Is it possible to make a "Save As" button for an image that is showed in a figure? This is my button that generates the image :
function GenAnaglif_Callback(hObject, eventdata, handles)
% hObject handle to GenAnaglif (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im_dr
global im_st
global im_final
im_final=contopire(im_st,im_dr, .5);
figure
imshow(im_final);
All i could come up with is this function with "imwrite" but this only saves a file with a default name in the application folder.I would really like the Save As button.
function Salveaza_Callback(hObject, eventdata, handles)
% hObject handle to Salveaza (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im_final
imwrite(im_final,'imagine.jpg','jpg')
I'm not advanced with Matlab so please if you guys can be specific with your answer, it would be great.
Thank you very much.

回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 6 月 15 日
You could have an edit box that has the the default file name but can be changed. Then when the save as button is called it saves with that.
%In saveas_callback(...)
fn = get(handles.edit_filename,'string');
imwrite(im_final,fn,'jpg');
  2 件のコメント
Quick Click
Quick Click 2011 年 6 月 16 日
Thank you !
Simple and efficient :D
Matthew M.
Matthew M. 2011 年 6 月 16 日
FYI, you should "accept" the answer too so he gets credit. :)

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


Krishna Kumar
Krishna Kumar 2011 年 6 月 16 日
You can modify sean de's suggestion by including a pushbutton next to the edit text and calling 'uigetfile' in the push button callback

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by