MATLAB Answers

Add a comment to an eps file created with saveas

1 view (last 30 days)
Emily on 23 Mar 2021
Edited: Emily on 23 Mar 2021
I have many scripts that read my data, plot it, and save the figure as an encapsulated postscript file (used to use export_fig from the file exchange, now am using saveas). Sometimes I want to recreate a figure, and have to figure out which script generated it. Is there a way for my script to programmatically add a comment to the preamble of the postscript file so I can leave myself clues for recreating it? The head of my .eps file looks like this:
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: (MATLAB, The Mathworks, Inc. Version \(R2019a\). Operating System: Linux)
%%Title: /home/etownsen/quantumplasmonics/Record/Disorder/2QE1by12w6/EnergyInitBasis2872QEsNotResw1stPl1by12w6Coul1tb-1EQE112EQE212ydHndCDa0.01Db0.3Lhop0.2Seed4.eps
%%CreationDate: 2021-03-10T10:44:35
%%Pages: (atend)
%%BoundingBox: 85 28 861 514
%%LanguageLevel: 3
So it seems likely that adding info to the "Creator" line would not hurt the eps file, and probably I can even safely add a line like
%%Script: /here/something.m
Ideally it gets written when I create the file, but it might also be okay to add it after creating. I'd like the comment to contain the name (and path) of the script that created the eps. (And maybe the line number? but that's getting greedy.)

Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by