Why does MATLAB R2016a or earlier on Windows show 'Undefined function or variable 'matlabrc'' and lose command functionality when MATLABPATH is set?
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 13 de Jun. de 2012
Editada: MathWorks Support Team
el 4 de Sept. de 2025 a las 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.
Respuesta aceptada
MathWorks Support Team
el 4 de Sept. de 2025 a las 0:00
Editada: MathWorks Support Team
el 4 de Sept. de 2025 a las 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!