Borrar filtros
Borrar filtros

Save Figure in workspace

30 visualizaciones (últimos 30 días)
Mauro De Francesco
Mauro De Francesco el 30 de Jul. de 2019
Comentada: Wu Yu-Wei el 19 de Abr. de 2021
I am trying to save a figure I have to the workspace. The current workflow involves using the print function and then reopen it using imread. Is there a way to jump over the print + imread functions and just save the image to a variable in the workspace? I need to save it with a certain resolution (1024x1024 pixels)
print('MoonImage','-dpng','-r300')

Respuestas (1)

Roshni Garnayak
Roshni Garnayak el 2 de Ag. de 2019
You can use the following lines of code to save the figure to workspace and set the desired resolution:
f= frame2im(getframe(gcf));
I=imresize(f,[1024,1024]);
For more information on the ‘gcf’ function, refer the following link:
  1 comentario
Wu Yu-Wei
Wu Yu-Wei el 19 de Abr. de 2021
How do you view or open this saved figure?

Iniciar sesión para comentar.

Categorías

Más información sobre Display Image en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by