Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving plots straight to PS without displaying

Status
Not open for further replies.

ch789

Computer
Mar 4, 2005
1
Hi.

This may be obvious, but I've spent days searching the internet for instructions on this, but without any luck.

I want to be able to save a plot without displaying it, so that I can leave Matlab running while it saves plots with different parameter values without opening new windows all the time.

I can do this in Octave using the code:
gset term postscript
gset( "output",[\"testplot",num2str(N),".ps\""])
plot(x,y)

This code runs through different values of N and calculates y as a function of N and saves the output as a postscript file.

I'd like to be able to do this in Matlab to speed things up, but am having some trouble! I'd be grateful if someone could tell me how to do it. I'm sure someone has written code to do this, as it seems so useful.

Thanks!

Chris
 
Replies continue below

Recommended for you

Hi,
In order to save the plots you need a figure object with an axes object on it. The figure can be invisible. Do the following:
hf=figure('Visible','off');
hx=axes('Parent',hf)
for n=1:N
plot(x:),n),y:),n),'Parent',hx);
print(hf,'-deps',['tryplot' num2str(n)])
end

Note: By default the new plot erase the old one.

Joe Sababa

The new BSTeX - Equation viewer for Matlab7

Joe
BSTeX- Equation viewer for Matlab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor