How to save a high resolution image in MTALB?

조회 수: 10 (최근 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 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