The problem is the CTF root directory is in some weird place that changes from version to version so you'd have to change it every time you compiled and released a new version.
One problem I recently found out about is that if the end user does not use the program for a long time, then Windows might delete some run-time library functions from your CTF if your CTF is in the "Automatic" folder.
On occasion, some of you may see an error
Undefined function or variable 'matlabrc'.
Undefined function or variable 'ctfroot’.
Error in checkRequiredMCRProducts (line 22)
Undefined function or variable 'ctfroot’.
This shows up in the console window (“DOS box”). Sometimes it might just flash briefly and vanish and the program never starts. The official solution given by Mathworks for this problem is below:
The solution is to delete the CTF extraction folder, and run the EXE again. If the MCR_CACHE_ROOT environment variable is not set, the CTF extraction location can be found at:
C:\Users\[username]\AppData\Local\Temp\[username]\mcrCache[version]
To get around the problem of Windows randomly deleting the files you need to specify that the CTF is in some known, permanent location that Windows won't touch, unlike the temporary folder it normally puts it into. So you can set a Sytemt Environment variable from the control panel:
MCR_CACHE_ROOT=C:\users\public\documents\MATLAB\MCR
Then when you run your program, it will unpack the CTF to that location.
Alternatively, you can put your data into a known place like "C:\Users\Public\Documents\MATLAB\YourData" -- this is what I do. Do you have just a few files or a whole folder of files that changes as the user uses your program?
Have you tried using the -a option in mcc? You can do that if you want to bundle your files to be shipped with your executable and it will always find them. However if you expect to be adding files to that folder, then you'll still need to have a folder where you keep the files that is in a known location, like D:\my data or somewhere and then use fullfile() to construct the full file name of your file whenever you need to use it.
0 件のコメント
サインインしてコメントする。