MATLAB's publish
takes a script and makes a PDF from it. Here, we want to add some basic info about the file that created the PDF to the PDF, programatically.
add this snippet of code to the bottom of the script that you will publish with MATLAB's publish() function (or my MakePDF.m wrapper)
%% Version Info
% The file that generated this document is called:
disp(mfilename)
%%
% and its md5 hash is:
Opt.Input = 'file';
disp(DataHash(strcat(mfilename,'.m'),Opt))