MATLAB: How to record the date when the program was compiled in MATLAB Compiler 4.14 (R2010b)

applicationdatedeployMATLABMATLAB Compilertime

I like to record when my program was compiled in order to get this information during runtime of the deployed application.

Best Answer

There is no built-in function that will do what you like to do. But to achieve this do the following.
I will talk about a function called BUILDDATE. This function will be generated right before doing the actual compiling. You will see this function later.
The first step is to modify your Code so that you will call the function, BUILDDATE, (returns the date of building your application) in deploy mode, only. In order to check this you can use the function ISDEPLOYED, e.g.
%this will be executed when in deploy mode, only
if isdeployed
fprintf('>>> Build date: %s <<<\n', builddate);
end
After you have done this, proceed with the following:
1.) Create your project in the deploytool as you would do it normally (do not try to include the BUILDDATE function, because it does not exist yet)
2.) Save your project, e.g. my_project.prj
3.) Close the deploytool and run the following code (make sure all paths are correct)
%creates function BUILDDATE which returns the date of compilation
fid = fopen('builddate.m','w');
fprintf(fid, 'function s = builddate\n');
fprintf(fid, 's=''%s'';\n',date);
fclose(fid);
%do the actual compiling
deploytool -build my_project.prj