フィルターのクリア

exportgraphicsunusably slow and memory overruns

24 ビュー (過去 30 日間)
Adam Snyder
Adam Snyder 2023 年 12 月 8 日
回答済み: Matt J 2023 年 12 月 8 日
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?

回答 (1 件)

Matt J
Matt J 2023 年 12 月 8 日

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by