MATLAB Memory: How to Fix Memory Issues Easily

  • Context: MATLAB 
  • Thread starter Thread starter Pythagorean
  • Start date Start date
  • Tags Tags
    Issues Matlab Memory
Click For Summary
SUMMARY

The discussion focuses on resolving memory issues in MATLAB, particularly when handling graphical outputs. Users experience memory errors when plotting multiple data sets, even with visibility turned off. Key solutions include avoiding excessive data points in plots and ensuring large variables are cleared within loops. The conversation highlights the inherent memory demands of MATLAB, prompting some users to consider alternatives like Python for data handling.

PREREQUISITES
  • Understanding of MATLAB 64-bit architecture
  • Familiarity with data plotting techniques in MATLAB
  • Knowledge of memory management practices in programming
  • Experience with variable handling and clearing in MATLAB
NEXT STEPS
  • Research MATLAB memory management techniques
  • Learn about optimizing MATLAB graphical outputs
  • Explore Python libraries for data visualization, such as Matplotlib
  • Investigate MATLAB's built-in functions for clearing variables and memory
USEFUL FOR

Data scientists, MATLAB users facing memory issues, and developers transitioning to Python for data visualization will benefit from this discussion.

Pythagorean
Science Advisor
Messages
4,430
Reaction score
327
I've read the (a?) MATLAB file on memory on their webiste. Basically, their advice deals with data generation, which I'm not having a problem with. I generated the data sets quite easily on my 64-bit dual core, while simultaneously posting on physicsforums and playing muds.

But once I got the graphical part, my computer kept getting swamped and memory errors kept popping up (no I'm not trying to run muds or browsers with it). Basicallly, I load and plot nine sets of data (axes) on each figure, then save it as a no compression tiff.

I do this all with the visibility off, so I'm supressing graphical output. I make sure to clear the variables before I load new ones.

I can do this once manually with no problems, but if I don't quit MATLAB and reopen it, the second manual run takes much longer and bogs my computer down (even after MATLAB has crashed and closed). I got the memory errors initially when I tried to automate the whole data set at once.
 
Physics news on Phys.org
@Pythagorean I know that it has been a long time since you posted the thread, but do you remember how you had solved this problem?
 
I don't for this specific case. But I remember two common gotchyas with memory in matlab.
1) don't try to plot too many points at once. Even if it's invisible.
2) make sure you're clearing big variables if you have a loop

Also, I remember Matlab was just a memory hog anyway. I've used nothing but python for the last couple years.
 
  • Like
Likes   Reactions: Wrichik Basu

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K