How do I use Saveas function to save figure2 ?

2 次查看(过去 30 天)
I have a Matlab code with multiple figures present in it.But I want to save Figure 2 as a jpg format.
I have seen people using "saveas(gcf,'Barchart.png')" and gcf is used for getting the current Fig. But I want only Figure2 to be saved as Barchart.png and not any other figure.

采纳的回答

Walter Roberson
Walter Roberson 2023-5-19
saveas(2,'filename.jpg')
For more security,
fig2 = figure(2);
saveas(fig2, 'filename.jpg')
.. you should probably have a handle to the figure anyway, as you need to use the handle in some operations to ensure that you are working with the figure you want.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Identification 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by