MATLAB: How to resolve issues associated with MATLAB Compiler Runtime cache corruption

cachecorruptionMATLAB Compilermcr

My application produced by MATLAB Compiler is no longer working after a Windows update. I understand that the update may have corrupted my MATLAB Compiler Runtime (MCR) cache files. How do I resolve these issues?

Best Answer

Delete the “mcrCache” folder used by the application and rerun the application.The “mcrCache” folder can be located by executing the following command in MATLAB Command window:
mcrcachedir
Note that “mcrCache” folders have the form “mcrCacheX.Y,” where X and Y indicate MATLAB Compiler Runtime (MCR) version. The “mcrCacheX.Y” output by the above command may not correspond to the version of the “mcrCache” folder used by your application.
Delete the “mcrCacheX.Y” folder used by the application. If you are unsure of which “mcrCacheX.Y” is used by your application, delete all folders of the form “mcrCacheX.Y” in the parent directory of the location returned by “mcrcachedir.”
For example, on my machine, “mcrcachedir” returns:C:\Users\Username\AppData\Local\Temp\Parth\mcrCache9.8
But the parent directory “C:\Users\Username\AppData\Local\Temp\Parth” contains folders “mcrCache9.1” and “mcrCache9.8.” Once you delete the appropriate “mcrCache” folder(s), try rerunning your application.
Alternatively, try changing the location of the “mcrCache” folder by typing the following into the Windows Command Prompt:
set MCR_CACHE_ROOT=<accessible_directory>
Where <accessible_directory> is some easy-to-find directory that you have the permission to modify (e.g. the Desktop). Then rerun the application from within the Windows Command Prompt by navigating to its directory and typing the application name in the same Windows Command Prompt.