how to save the content of the current figure as an image?
Mostra commenti meno recenti
how to save the content(which is an image) of the current figure as an image?
I have about 30 figure ...
I want to use MATLAB commands to save them in for loop
Risposta accettata
Più risposte (3)
Francesco Ciriello
il 20 Nov 2019
Save current figure
imwrite(getframe(gcf).cdata, 'myfilename.png')
Save current axis
imwrite(getframe(gca).cdata, 'myfilename.png')
1 Commento
Raviteja Vangara
il 12 Mag 2020
I think this deserves an upvote. I have an image with alpha data, and traditional saveas options wouldnt store alpha data in saved PNG file.
using,
H = getframe(gca)
imwrite(H.cdata, 'myfilename.png')
This saves current figure as it appears on the window.
Mikhail
il 18 Set 2014
0 voti
If you want to save in with your hands - just click file-> save figure.
1 Commento
Nisreen Sulayman
il 18 Set 2014
Image Analyst
il 18 Set 2014
0 voti
Use imwrite() if you just want to save the image you display. If you want to save the axes or figure, use export_fig(). http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
2 Commenti
Nisreen Sulayman
il 19 Set 2014
Modificato: Nisreen Sulayman
il 19 Set 2014
Image Analyst
il 19 Set 2014
Just use fullfile() when you construct the file name that you pass in to export_fig().
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!