How to save a high resolution image in MTALB?

10 Ansichten (letzte 30 Tage)
Nisar Ahmed
Nisar Ahmed am 8 Dez. 2022
Kommentiert: Jonas am 8 Dez. 2022
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)

Akzeptierte Antwort

Jonas
Jonas am 8 Dez. 2022
exportgraphics() is available since 2020a
which release are you using?
  2 Kommentare
Nisar Ahmed
Nisar Ahmed am 8 Dez. 2022
@Jonas I am using R2018b
Jonas
Jonas am 8 Dez. 2022
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')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by