Saving plots straight to PS without displaying
Saving plots straight to PS without displaying
(OP)
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
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





RE: Saving plots straight to PS without displaying
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
http://www.geocities.com/bstex2001/
Joe
BSTeX- Equation viewer for Matlab
http://www.geocities.com/bstex2001