|
From: Petr M. <mi...@ph...> - 2009-02-06 17:48:57
|
> > There is a strange error happening with a not-yet-used variable: > > > > gnuplot> load 'bug.gp' > > "bug.gp", line 4: warning: b is not a string variable > > > > where bug.gp: > > > > set macros > > a='' > > if (1) a="plot x"; @a > > if (1) b="plot x*x"; @b > > This has always been a limitation on the use of macros. > The substitution is done for each whole line as the line > is read in, before any of the commands on that line have > been executed. I see; a better demonstration of this effect it rather this one: set macros a='print 789' if (1) a="print 123"; @a if (1) b="print 456"; @b The solution seems to be: set macros if (1) b="print 999" if (1) @b > For most purposes, the use of macros has been entirely supplanted > by string variables. In the case above: > > if (1) a="plot x"; evaluate(a) Thanks for this hint, it works fine in gnuplot-cvs. Finally I had to use the construct with macros because the script had to run on gnuplot 4.2.x. --- PM |