Why do I get the Error using load. Unable to read file '<filename>'. No such file or directory when running compiled application?

5 views (last 30 days)
I have a compiled application that has throws an error:
" Error using load
Unable to read file '<file:///C:/Users/tawong/AppData/Local/Temp/tawong/mcrCache9.1/HEARTs0/data_analysis/E2E0070.txt'. C:\Users\xyz\AppData\Local\Temp\tawong\mcrCache9.1\HEARTs0\data_analysis\E2E0070.txt'.> No such file or directory. "
I use deploytool --> application compiler to compile the application and add a folder "data_analysis" to the "Files required for your application to run". The program runs fine and accesses the files in the data_analysis folder most of the time but every once in awhile I receive the above error. I then have to add the .txt file to that temporary folder manually. Is there something I can do so that I don't have to add the text files to that temporary location? I would like the information contained in the file to remain protected from access and tampering and that's why I include it in the compiling.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Jul 2019
The default location for MCR cache directory is under a temp folder.
This might happen if some Windows program like Disk Cleanup is deleting files from Temp folder.
To fix this, change the location of MCR Cache Root by adding system environment variable-
MCR_CACHE_ROOT to some other location in directory.

More Answers (0)


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!