Save Figure in workspace

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')

回答 (1 件)

Roshni Garnayak
Roshni Garnayak 2019 年 8 月 2 日

0 投票

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 件のコメント

Wu Yu-Wei
Wu Yu-Wei 2021 年 4 月 19 日
How do you view or open this saved figure?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangePrinting and Saving についてさらに検索

質問済み:

2019 年 7 月 30 日

コメント済み:

2021 年 4 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by