From help-octave-request at bevo dot che dot wisc dot edu Wed Jan 30 05:38:52 2002 Subject: Re: plot to file from executable script -problem refined From: Pierre-Andre Cornillon To: Pieter Thysebaert cc: help-octave at bevo dot che dot wisc dot edu Date: Wed, 30 Jan 2002 12:36:58 +0000 (WET) If you use eval it could be ok : eval(['gset output',filename,';']) On Wed, 30 Jan 2002, Pieter Thysebaert wrote: > > On Monday 28 January 2002 16:56, Pieter Thysebaert wrote: > > Hi, > > > > I've created an executable octave script to control my calculations; > > > > what's happening is this: > > > > hold on; > > > > for k=min:max > > > > > > plot data(k) t title(k) > > endfor > > > > (this draws in an x11 window as it's calculations proceed) > > > > Now, I've appended these lines to the code (that's: after the for-loop) > > > > gset terminal postscript eps enhanced color > > gset output "output.eps" > > replot > > > > However, this seems to spit out the postscript code to stdout (and I wanted > > it in "output.eps") (and simply running "./scriptfile > output.eps" gathers > > ALL output (not just the graph) in the file) > > > > Why is that, and how do I get the output where I want i.e. why doesn't > > replot do what I was thinking it would do when in non-interactive mode ? > > Well, I've been able to narrow the problem: > > I did not add gset output "output.eps" as a command, but rather > > filename="output.eps"; > gset output filename > > I figured that this would make filename a string-variable and the gset output > would work (doing similar things with a variable title, and then doing a > gplot data t title does work) > > However, gnuplot seems to choke on it: > It says "filename expected", so I suppose octave is passing the variable name > rather than the contents of it (=the filename). > > Can I plot to a file if its name is to be determined at run-time ? > > Pieter > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------