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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by