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

23 次查看(过去 30 天)
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.

采纳的回答

MathWorks Support Team
MathWorks Support Team 2025-9-4,0:00
编辑:MathWorks Support Team 2025-9-4,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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

尚未输入任何标签。

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by