Why do I get an error "mclCopyDir failed: fl:filesys​tem:Access​Denied Failed to copy user-level MATLAB settings ..." during my call to mcc using MATLAB Compiler SDK R2020a?

Previously, I was able to compile my application, but today I receive access denied errors for my preference directory/temporary directory even if I can manually copy the mentioned files.
What could be the reason for this failure?
I am running another very time consuming MATLAB application in parallel which is why I want to avoid to restart MATLAB at this point (to avoid loosing these results).
Here is a copy of the log file I get:
mcc -o MyApp2020a_7p65 -W 'WinMain:MyApp2020a_7p65,version=7.65' -T link:exe -d E:\username\MATLAB_RA\username\Deployment\MyApp\MyApp2020\for_testing -v E:\username\MATLAB_RA\username\Applic\img\MyApp\MyApp.m -a E:\username\MATLAB_RA\username\Applic\img\MyApp\xyz_Diag_07.01.2021_1445.mat -a E:\username\MATLAB_RA\username\Applic\img\MyApp\abc.m -a E:\username\MATLAB_RA\username\Applic\img\MyApp\xyz2.xlsx -a E:\username\MATLAB_RA\common\Applic\toolbox\abc2.class -a E:\username\MATLAB_RA\common\Applic\toolbox\abc2.java -a E:\username\MATLAB_RA\username\Applic\img\MyApp\xyz3_Side_ver03.m -a E:\username\MATLAB_RA\common\Applic\toolbox\abc3.m -a E:\username\MATLAB_RA\username\Applic\img\MyApp\Sxyz.png -r E:\username\MATLAB_RA\username\Deployment\MyApp\MyApp2020_resources\icon.ico
Compiler version: 8.0 (R2020a)
Dependency analysis by REQUIREMENTS.
mclCopyDir failed: fl:filesystem:AccessDenied
Failed to copy user-level MATLAB settings from "C:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2020a" into temporary directory "C:\Users\username\AppData\Local\Temp\mcc.149528_0\user". Cannot continue without risk of corrupting MATLAB settings.

 Accepted Answer

If you're running some other MATLAB session doing something else at this same time, perhaps somehow some file in the preferences is locked and it can then not be copied - prior to being compiled into the application. ("C:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2020a" is your MATLAB preference directory, actually.)
If that is indeed the case, you might be able to work around this by running this second MATLAB session in which you want to compile the component 
with a new/separate preferences directory
.
This can be done by using the MATLAB_PREFDIR environment variable.
I.e. open a cmd.exe prompt and run
set MATLAB_PREFDIR=c:\some\location\for\this\MATLABc:\full\path\to\bin\matlab.exe
When setting the variable in a certain cmd Window and starting MATLAB from there, this all applies only for this cmd Window and does not affect MATLAB sessions started in any other way.

More Answers (0)

Categories

Products

Release

R2020a

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!