Where Does MATLAB Keep Files and Settings?
Where MATLAB keeps user files in Documents/MATLAB and settings in the prefdir folder on each OS.
Last updated
MATLAB keeps user files in Documents/MATLAB (the userpath folder, first on the search path) and settings, favorites and desktop layouts in a per release prefdir folder (%APPDATA%\MathWorks\MATLAB\R20XXx on Windows, ~/.matlab on Unix). Two folders, two jobs: code versus configuration.
New releases create fresh siblings of both rather than migrating, which is why settings vanish on upgrade day. Copy the previous release prefdir contents into the new one (same major family) to carry layouts across, and keep code in userpath where releases never interfere.
Where MATLAB stores this, by platform
%USERPROFILE%\Documents\MATLAB
Paste %USERPROFILE%\Documents\MATLAB into Explorer for code. Settings live in %APPDATA%\MathWorks\MATLAB\<release>. Confirm either with prefdir and userpath commands.
~/Documents/MATLAB
Same Documents/MATLAB userpath. Settings under ~/.matlab/<release>. Confirm with prefdir.
~/Documents/MATLAB
userpath only exists if ~/Documents does; otherwise it returns empty. Same ~/.matlab settings root. Confirm with prefdir.
Frequently asked questions
How do I print my exact MATLAB folders?
Run prefdir in the Command Window: it prints the live settings folder for your release. userpath without arguments prints the user files folder. Both are per release, so R2024b and R2025a keep separate trees.
How do I make MATLAB start in my own folder?
Set Initial working folder to userpath in Home > Settings > General. MATLAB then starts in Documents/MATLAB with it atop the search path. The MATLABPATH variable appends further folders below userpath for shared toolboxes.
Notice an outdated path? Let us know.