|
From:
<br...@ph...> - 2005-06-28 15:31:40
|
Taro Sato wrote:
> It seems the gnuplot has difficulty distinguishing a user-defined
> function and a string file name stored in a variable.
> reset
> f(x) = x
> fdat = 'xy.dat'
> plot f(x), fdat u 1:2
> pause -1
> "plot.nogood.gp", line 4: warning: encountered a string when expecting a number
> "plot.nogood.gp", line 4: NB: you cannot plot a string-valued function
This is not exactly a bug, but a known syntactical limitation. The way
around it is to drop the parser a hint that fdat is meant to be a
string, not a number, like this:
plot f(x), ''+fdat u 1:2 # or was that ''.fdat ?
Concatenating fdat with the empty string yields a string constant, and
the parser seeing the "'" that start off this entry in the command line
can directly deduce that this is not a number, but a string.
|