Figure taking up too much ram and sometimes crashing.

조회 수: 7 (최근 30일)
Derek
Derek 2023년 8월 16일
답변: Angelo Yeo 2023년 8월 16일
I am doing pretty big basins of attraction, and every time I create them, they end up being really slow and taking up a ton of ram. It will take a few minutes for me to be able to save them, and then it will take much more for it to end up saving. One time, it crashed and Matlab offered a package that I could download to help process the figure better, but I cannot seem to find it. I could also scale down the basins, but they look nice and help distinguish well.
I would appreciate if somebody knew what package could help with this.

채택된 답변

Angelo Yeo
Angelo Yeo 2023년 8월 16일
I believe one of the options you can take is to save the figure to disk without rendering the figure window. Please refer to the code below and see if it would be a good option for you.
h = figure('Visible','Off'); % Creating a figure and not displaying it
ax = axes; % Create an Axes;
plt = plot(ax,1:10,1:10,'r'); % Plot an arbitrary line in the axes
set(h,'CurrentAxes',ax); % Set current Axes of figure to 'ax'
print(h,'-djpeg','fname.jpeg')% Print the plot to file 'fname.jpeg'
% exportgraphics(h, 'myfilename.png'); % An alternative for "print".
Note that exportgraphics was introduced in R2020a.

추가 답변 (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