tags:

views:

1260

answers:

3

Does anyone know if it's possible to automatically write a figure out to a .eps file in MATLAB?

I'm running a script that produces a large number of graphs, and it'd be nice if I didn't have to manually save each one!

Cheers, Ed

+1  A: 

This was answered in this other question, using the PRINT command. Although that question dealt with making .tiff images, it should be straightforward to modify the code given in those answers to write a .eps.

gnovice
I'm not loading an image in or out, this is a set of automatically generated graphs, so I'm not sure the same syntax applies.
Ed Woodcock
Although the text of the question just shows IMREAD and IMWRITE, some of the answers show how to use the PRINT function to output a plotted image.
gnovice
+7  A: 

print function does that.

SilentGhost
Thanks, saves me a lot of effort =]
Ed Woodcock
+1  A: 

print or saveas will do the trick.

saveas(fig_handle, 'filename','eps')
print('-deps',fig_handle)
print -deps 1

If you want to specify the output file name, you're better off using saveas.

TR
actually, you can specify the filename just fine with -print -epsc filename
Ed Woodcock

related questions