How to save a high resolution image in MTALB?

11 visualizaciones (últimos 30 días)
Nisar Ahmed
Nisar Ahmed el 8 de Dic. de 2022
Comentada: Jonas el 8 de Dic. de 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)

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by