I'm using matlab to write figures as eps files for use in LaTeX, using:
print( '-depsc', 'filename.eps');
and I'm keeping those eps files in version control. As I'm generating a lot of figures at once, but only changing one or two of them, often the only change in a particular eps file is:
-%%CreationDate: 06/29/2011 17:52:57
+%%CreationDate: 06/30/2011 19:18:03
which isn't valuable information. Is there a way to stop matlab from writing the CreationDate?
Dirty solutions encouraged...
One solution is to remove that line altogether, and rely on the file system to keep track of creation/modification date. This can be done in a lot of ways using common shell tools:
# sed
sed -i file.eps '/^%%CreationDate: /d'
or
# grep
grep -v '^%%CreationDate: ' file.eps > tmp && mv tmp file.eps
If you are on a Windows machine, MATLAB should have a Perl interpreter included:
# perl
perl -i -ne 'print if not /^%%CreationDate: /' file.eps
From inside MATLAB, you can maybe do the following to call a one-line Perl program:
%# construct command, arguments and input filename (with quotes to escape spaces)
cmd = ['"' fullfile(matlabroot, 'sys\perl\win32\bin\perl.exe') '"'];
args = ' -i.bak -ne "print if not /^%%CreationDate: /" ';
fname = ['"' fullfile(pwd,'file.eps') '"'];
%# execute command
system([cmd args fname])