How to save a high resolution image in MTALB?

7 次查看(过去 30 天)
Hi
I want to save my images in MATLAB with minimum 300DPI roslution. Following is my figure code (below) and when I try to save with following code (exportgraphics(f,'elastic avo.png','Resolution',300)) I go this error
Undefined function or variable 'exportgraphics'.
Error in PLOTTING (line 24)
exportgraphics(f,'elastic avo.png','Resolution',300)
Figure code is:
f=figure; subplot(121); plot(iters,hist/max(hist),'-b', 'displayname', 'S/N = Infinity','LineWidth',1.5); hold on;
plot(iters,hist_snr/max(hist_snr),'-.r', 'displayname', 'S/N = 50','LineWidth',1.5);
set(gca,'xtick',[0:100:200]); set(gca,'ytick',[0:0.2:1]); ylim([0 1]); title('Elastic inversion')
grid on; set(gca,'GridLineStyle','--'); xlabel('Iterations'); ylabel('Error function'); legend
subplot(122); plot(itr4d,avo4dhist/max(avo4dhist),'-b', 'displayname', 'S/N = Infinity','LineWidth',1.5); hold on;
plot(itesnr,avohist_snr/max(avohist_snr),'-.r', 'displayname', 'S/N = 5','LineWidth',1.5);
set(gca,'xtick',[0:10:50]); set(gca,'ytick',[0:0.2:1]); ylim([0 1])
grid on; set(gca,'GridLineStyle','--'); xlabel('Iterations'); ylabel('Error function'); legend
set(gcf, 'position', [400 285 1127 443]);
exportgraphics(f,'elastic avo.png','Resolution',300)

采纳的回答

Jonas
Jonas 2022-12-8
exportgraphics() is available since 2020a
which release are you using?
  2 个评论
Jonas
Jonas 2022-12-8
so that's your problem. exportgraphics is not available to you. To save at resolution 300dpi, you can e.g. use
print('elastic avo.png','-dpng','-r300')

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by