MATLAB: Set paths disappear after restart

search pathset path

Hello together,
latley it occures to me, that I loose paths that I have set in matlab. I use File -> set Path… -> add Folder… choose the relevant folder and save it. The new added path works until i restart Matlab. Then the new path is disappeared from the list. And it seems, that all the previous added paths are deleted aswell.
Can't tell where the problem is, because thats the way i always did it.
Does anyone know how it is possible, how the path list is deleted? Is there a file, where it is stored?
Thank you for your effort.
Rafael

Best Answer

The path is stored in the file pathdef.m inside Matlab's program directory. If you do not work with admin privileges (as recommended), you do not have write permissions for this file and all changes of the path are temporarily only. This is useful on a multi-user system, because the pathdef.m file belongs to all users.
I've added one folder to the path in pathdef.m file, which contains a function, which adds the user-defined paths temporarily depending on the user and current project. This works reliably and flexible. Alternatively you can create a startup.m and finish.m file to store the current path persistently between sessions using setpref and getpref.