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

2 comentarios

Geoff Hayes
Geoff Hayes el 16 de Abr. de 2018
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 el 16 de Abr. de 2018
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.

Iniciar sesión para comentar.

 Respuesta aceptada

Geoff Hayes
Geoff Hayes el 16 de Abr. de 2018

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?).

Más respuestas (0)

Preguntada:

el 15 de Abr. de 2018

Respondida:

el 16 de Abr. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by