How do I resolve issues associated with MATLAB Runtime cache corruption?
52 views (last 30 days)
Show older comments
MathWorks Support Team
on 29 Jul 2020
Edited: MathWorks Support Team
on 5 May 2025
My MATLAB standalone application produced by MATLAB Compiler is no longer working. For example, I am getting errors such as
Unrecognized function or variable 'matlabrc'.
Unrecognized function or variable 'ctfroot'.
Error in => runtimeInitializationChecks.m at line 23
Or:
Undefined function or variable 'matlabrc'.
Undefined function or variable 'ctfroot'.
How do I resolve these issues?
Accepted Answer
MathWorks Support Team
on 5 May 2025
Edited: MathWorks Support Team
on 5 May 2025
When a compiled application runs, the files in the deployable archive (CTF file) are extracted to the MATLAB Runtime component cache. If this cache becomes corrupted or inaccessible, you may encounter errors such as "Undefined function or variable", or other startup errors.
To resolve these issues, clear the MATLAB Runtime cache as described in the answer below:
Change the MATLAB Runtime cache location:
If the errors persist—especially when using MATLAB Runtime R2024a or earlier, where the cache is stored in the TEMP folder—try changing MATLAB cache location. Open a Windows Command Prompt and enter:
set MCR_CACHE_ROOT=<accessible_directory>
Replace <accessible_directory> with a folder you can modify (e.g., your Desktop or a folder outside your system drive). Then run your application from the same Command Prompt. If this resolves the issue, consider adding MCR_CACHE_ROOT as a permanent environment variable. Contact your system administrator if you need help.
For additional details, see the documentation Change Options Using Environment Variables.
0 Comments
More Answers (0)
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!