MATLAB Answers

Using epscombine with 2014b?

2 views (last 30 days)
Tiffany
Tiffany on 21 Nov 2014
Answered: Richard Quist on 1 Apr 2015
I'm trying to run epscombine.m with Matlab 2014b, but I keep getting the following error message:
Undefined function or variable "beginobject".
Error in epscombine (line 65)
for line = beginobject:length(text2{:})
Equivalently, "endobject" doesn't seem to be defined either. I'm guessing it has something to do with the new graphics setup, but I can't pinpoint the problem. The separate eps files (the vector and bitmap graphics) are generated just fine, but combining them leads to these errors. Can someone help with the routine, or propose an alternative routine/command to use? Thanks.
  2 Comments
Tiffany
Tiffany on 31 Mar 2015
Hi Doug,
Sorry--somehow I never got notified of a response to this message! I haven't gotten around to figuring this out yet as I've been getting away with using an earlier version of MATLAB, but I should really solve this.
I'm using epscombine to combine data and axes to make more high-quality figures than from simple MATLAB exports. As you said though, I'm guessing the 2014b graphics system is more equipped to handle this. The relevant chunk of code is as follows:
print -depsc2 -painters axes.eps
figure('color',[1 1 1]);
print -depsc2 -zbuffer data.eps
epscombine('axes.eps','data.eps',[filename])
Any thoughts? Thanks in advance.

Sign in to comment.

Answers (1)

Richard Quist
Richard Quist on 1 Apr 2015
The epscombine utility is looking for text that isn't present in EPS files generated in R2014b, which leads to the error you are getting.
As Doug mentioned, you may be able to get what you want from MATLAB directly without using that utility.
Prior to R2014b, MATLAB would often generate an EPS file with an embedded image, rather than a file that was fully vectorized; even if you used the -painters option with the print command more complicated scenes were still exported as an image. This resulted in poor scaling as the output file was resized, and text often suffered as a result.
In R2014b, MATLAB will usually produce a truly vectorized file when printing/exporting to EPS (or any of the other vector formats, like PDF). It will still produce a file containing an image if the scene is deemed too complex, but if you specify the -painters option that will be honored, and the resulting file will contain the vector instructions and not an image.
I hope that helps.
Rich

Community Treasure Hunt

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

Start Hunting!