Why does MATLAB R2016a or earlier on Windows show 'Undefined function or variable 'matlabrc'' and lose command functionality when MATLABPATH is set?
23 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2012-6-13
编辑: MathWorks Support Team
2025-9-4,10:54
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
2025-9-4,0:00
编辑:MathWorks Support Team
2025-9-4,10:54
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.
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!