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

1 visualizzazione (ultimi 30 giorni)
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');

Risposte (1)

Abhishek Chakram
Abhishek Chakram il 11 Ott 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

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by