Effacer les filtres
Effacer les filtres

exportgraphicsunusably slow and memory overruns

24 vues (au cours des 30 derniers jours)
Adam Snyder
Adam Snyder le 8 Déc 2023
Réponse apportée : Matt J le 8 Déc 2023
I'm using exportgraphics built-in on a simple figure (four subplots, each one is a scatter plot of 500 data points, nothing crazy). When I call exportgraphics(gcf,'myfile.pdf'), it goes "busy" for up to five minutes and then throws a java heap space memory error. I'm using MATLAB R2020b on an iMac running OSX 13.6. It doesn't seem to matter how minimal of a figure I try to export; it always hangs and then errors. I mean, this function should be expected to work, right? What gives?
Just to quickly follow up: if I shut everything down, restart, open a fresh instance of MATLAB and then run this MWE, then I can just barely get it to export:
theFigure = figure;
scatter(randn(500,1),randn(500,1));
tic
exportgraphics(theFigure,'/users/adam/desktop/test2.pdf');
toc
Elapsed time is 40 seconds... should be faster than that, no?
Hm... if I run the same code again immediately after that without making any other changes, then elapsed time is closer to 1 second. Still very slow, but why is the first instance 40 seconds then but the next call is only 1 second? Why is it I can't even get it to output anything at all reliably if the figure is even moderately sized? This should be a very basic function to save graphics, right?

Réponses (1)

Matt J
Matt J le 8 Déc 2023

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by