How to add a save feature in GUI? I tried this, but doesn't work

1 vue (au cours des 30 derniers jours)
Kuhen Suresh
Kuhen Suresh le 18 Avr 2021
function save_user_Callback(hObject, eventdata, handles)
% hObject handle to save_user (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
saveas(gcf,'output.jpg');

Réponses (1)

Abhishek Chakram
Abhishek Chakram le 11 Oct 2023
Hi Kuhen Suresh,
It is my understanding that you want to add a save feature in GUI. Here are the steps to achieve the same:
  1. Add a “uibutton” to the GUI
  2. Add a “ButtonPushed” callback to it.
  3. Use “exportgraphics” function to save it in any format.
Here is a sample code for the same:
function ButtonPushed(app, event)
exportgraphics(app.UIAxes,'LinePlots.jpg')
end
You can refer to the following documentations to know more about the functions used:
Best Regards,
Abhishek Chakram

Catégories

En savoir plus sur Printing and Saving dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by