I am attempting to utilize some variables as arguments to
be passed to gnuplot. I get an error "undefined variable"
when I attempt this even though I know the variable is
defined and exists in the current scope.
octave:23> gset xrange [a:b];
line 0: undefined variable: a
If I just put the number in the gnuplot command everything
works as I expect with no error:
octave:24> gset xrange [1:2]
What is the proper way to accomplish the passing of
variable arguments to gnuplot?
Ray> If I just put the number in the gnuplot command everything works as I
Ray> expect with no error:
Ray> octave:24> gset xrange [1:2]
Ray> What is the proper way to accomplish the passing of variable
Ray> arguments to gnuplot?
You can use eval on the return from sprintf as in
octave:1> eval(sprintf("gset xrange [%d:%d]", 2, 3))
(creates window with a straight line between 2 and 3
as selected by gset)