MATLAB: Does the CTF-archive of the MATLAB Compiler-generated application keep re-extracting each time I execute the application

ctfextractMATLAB Compilertimetimezone

I have a stand-alone application generated by the MATLAB Compiler. On one particular machine, I noticed that each time I execute this application, the CTF-archive re-extracts.
I understand from the documentation that the CTF-archive only extracts the first time an application is executed and am wondering why this is not so in my case.

Best Answer

MATLAB Compiler-generated applications extract the CTF-file if the extracted version either does not exist, or appears to be older that the CTF-file. Inconsistencies in the file timestamps can cause unneeded re-extractions.
The CTF-file extracts based on the GMT-relative time; so if the TimeZone is different from the system time, the CTF would re-extract until both the times match. That is, for example, if the system time was set to 2:20 PM (which is the GMT -5 EST), but the TimeZone was set to, say, Jerusalem (GMT + 2), the time difference would be 7 hours. Thus, until the two times matched, the CTF-archive would re-extract each time the EXE-file was executed.
You should not see this issue if your applications were developed in one time zone (for example in an office in the US) and deployed in another time zone (for example in Australia), since the systems in each of these offices would have the appropriate time and time zone settings.
Similar issues may occur if the system clock is incorrect, as in the case of a machine whose clock battery could not sustain the clock during a power outtage. For more information, see the Related Solution below.