Why does MATLAB R2016a or earlier on Windows show 'Undefined function or variable 'matlabrc'' and lose command functionality when MATLABPATH is set?

23 views (last 30 days)
When starting MATLAB R2016a or earlier on Windows, I receive the following error:
ERROR: ??? Undefined function or variable 'matlabrc'.
After this, all functions entered in the command window return similar "Undefined function or variable" errors.
This began occurring in my older MATLAB installations after I set a MATLABPATH environment variable, following the instructions in Add Folders to the MATLAB Search Path at Startup. MATLAB R2016b and later do not show this error, and those versions correctly add the folder specified in MATLABPATH to the path.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 Sep 2025 at 0:00
Edited: MathWorks Support Team on 4 Sep 2025 at 10:54

What This Issue Means

This error is due to the presence of a MATLABPATH environment variable. In MATLAB R2016a and earlier on Windows, this feature is not supported. It is only supported on UNIX and macOS platforms for those versions.
In R2016a and earlier on Windows, if MATLABPATH is set and does not include the directory $matlabroot\toolbox\local (where $matlabroot is the root MATLAB directory), MATLAB cannot access built-in functions, as it limits the search path to only what's defined in the variable.

Try This Workaround

The recommended solution is to remove the MATLABPATH environment variable entirely when using MATLAB R2016a or earlier on Windows.
If there is only a single MATLAB installation on your computer, you can resolve the error by updating the MATLABPATH environment variable to include the $matlabroot\toolbox\local directory. However, since this path is MATLAB-release specific, this approach will cause compatibility issues if you have multiple MATLAB installations and is therefore not recommended.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!