How to save a high resolution image in MTALB?

6 ビュー (過去 30 日間)
Nisar Ahmed
Nisar Ahmed 2022 年 12 月 8 日
コメント済み: Jonas 2022 年 12 月 8 日
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 件のコメント
Nisar Ahmed
Nisar Ahmed 2022 年 12 月 8 日
@Jonas I am using R2018b
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 Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by