Prevent Matlab write to CreationDate to eps file

I use matlab to write numbers as eps files for use in LaTeX, using:

print( '-depsc', 'filename.eps'); 

and I save these eps files in version control. Since I generate many digits at a time, but changing only one or two, 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 is not valuable information. Is there a way to stop Matlab from writing CreationDate?

Dirty decisions ...

+4
source share
1 answer

One solution is to delete this line as a whole and use the file system to track the creation / change date. This can be done in many 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 computer, MATLAB should include a Perl interpreter:

 # perl perl -i -ne 'print if not /^%%CreationDate: /' file.eps 

From within MATLAB, you can do the following to invoke a single-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]) 
+4
source

All Articles