Why does MATLAB R2016a or earlier on Windows show 'Undefined function or variable 'matlabrc'' and lose command functionality when MATLABPATH is set?
조회 수: 28 (최근 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!