MATLAB: Where is the workspace saved

memoryworkspace

Pretty straightforward question I guess. Where is the workspace held, in my computer? Is it on the RAM, on the hard drive, or a combination of both?
Is any form of "workspace management" useful? Such as clearing unused variables, or avoiding to keep a lot of huge variables loaded at the same time?

Best Answer

The workspace is saved in RAM memory. You can also save it to disk to a mat file if you call save(). The main functions for cleaning up are clc, clear, close, and delete. Each of those has several options so check them out in the help. One way to clean up most stuff is
clc;
close all force;
clear all;
clear global;
You can make a shortcut on your toolbar called "Clean up" to do all that. It's often recommended to make such a button by Mathworks trainers.
Related Question