How to do a "Save" and "Exit" button in Matlab Gui. I need help with the callback function

댓글 수: 2

Geoff Hayes
Geoff Hayes 2018년 4월 16일
Ubaashan - are you creating your GUI with GUIDE, App Designer, or programmatically? When the user presses the save button, presumably you want to save something to a file or...? Please clarify.
Ubaashana Ramesh
Ubaashana Ramesh 2018년 4월 16일
Geoff, I am using GUIDE. I am doing doing a GUI for Image watermarks. This is how it works, when the user has finished watermarking, the watermarked image has to be saved in the desktop - once the "Save" button is clicked.

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

 채택된 답변

Geoff Hayes
Geoff Hayes 2018년 4월 16일

0 개 추천

Ubaashana - in the (save) push button callback, you will save the data to file, possibly using imwrite. For example,

 function pushbutton1_Callback(hObject, eventdata, handles)
 % get the image data to save (from an axes or the handles structure)
 imgToSave = ...;
 % save to file
 filename = ...;
 imwrite(imgToSave, filename);

I'm assuming that you can easily get the watermarked image from the handles structure and that the filename is known (or are you asking the user for the filename?).

추가 답변 (0개)

질문:

2018년 4월 15일

답변:

2018년 4월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by