MATLAB: Can’t I save the MATLAB path on Windows with User Account Control (UAC) on

deniedMATLABpathpermissionsavetounable

I am trying to save the MATLAB path on Windows with the User Account Control (UAC) set to "on".
MATLAB is installed in a directory protected by UAC (e.g., C:\Program Files).
If try to execute the function SAVEPATH, my path is not saved and I receive the following warning:
>> savepath
Warning: Unable to save path to file 'C:\Program Files\MATLAB\R2009a\toolbox\local\pathdef.m'.
> In savepath at 162
If I try to save the MATLAB path from PATHTOOL ('Set Path' dialog) I get the message:
MATLAB cannot save changes to the path.
The path file, pathdef.m, might be read-only
or might be in a directory for which you do not
have write access.
You can save pathdef.m to a different location,
In order for MATLAB to user the pathdef.m
in future sessions, you need to save it in your
MATLAB startup directory (the directory from
which you start MATLAB).
Would you like to save pathdef.m to another location?
I have full administrative privileges on this computer.

Best Answer

If MATLAB is installed in the default directory (C:\Program Files\...) with UAC enabled, write access to "pathdef.m" will be blocked.
There are three ways to work around this issue:
1. Temporarily turn UAC off by right-clicking on the MATLAB icon, and selecting "Run as Administrator", or
2. Permanently turn UAC off through the Windows Control Panel, or
3. Install MATLAB outside of the "C:\Program Files" folder.
If you are encountering this issue when using the 'pathtool' dialog, note that you can still make temporary changes to the MATLAB path which persist only for your current session. You can do this by adding a folder with the 'pathtool' and then closing the window without clicking "Save", or by using the 'addpath' function:
For more information on the UAC, which was introduced with Windows Vista, see the following Microsoft article: