![output.bmp](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226399/output.bmp)
How to save a GUI figure in matlab
49 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226067/image.gif)
Like this picture I wanted to save my GUI figure. But I dont know how to do that
0 commentaires
Réponses (3)
Murugan C
le 26 Juin 2019
If you press Save Fig button in gui, below code gcf will capture your window and save in bmp format into your current directory.
saveas(gcf,'output','bmp')
![output.bmp](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226399/output.bmp)
1 commentaire
Robert
le 2 Déc 2019
Hi,
thanks to this example, which solved my problem first. Nevertheless I would like to save a gui window in png or jpg-format, because the size of bmp ist pretty big. If I choose jpg or png, only a small part of the figure is saved. Do you know a solution for this?
Kind regards
Robert
Himanshu Rai
le 24 Juin 2019
Modifié(e) : Himanshu Rai
le 24 Juin 2019
Have you tried export_fig() - https://in.mathworks.com/matlabcentral/fileexchange/23629-export_fig
0 commentaires
Yash Totla
le 24 Juin 2019
% ...
h = figure;
plot(X, y, '-bs', 'Linewidth', 1.4, 'Markersize', 10);
% ...
saveas(h,name,'fig')
saveas(h,name,'jpg')
This way, the figure is plotted, and automatically saved to the desired file format.
Alternatively you can wait for the plot to appear and click 'save as' in the menu.
1 commentaire
Rik
le 24 Juin 2019
Since the menu is generally disabled in a GUI, that option is probably not available.
Voir également
Catégories
En savoir plus sur Printing and Saving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!