help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing variable to 'gset arrow'


From: Kai Habel
Subject: Re: passing variable to 'gset arrow'
Date: Tue, 04 May 1999 11:49:21 +0200

David Larom wrote:
> 
> I can't get octave to plot an arrow with variable instead of constant
> input, while it works fine in gnuplot. In gnuplot, I can say:
> 
> plot(sin(x))
> a=5
> set arrow from a,0 to a,1
> replot
> 
> and the arrow appears on the plot just fine.
> HOWEVER,
> if in octave I say:
> 
> b=-10:10;
> plot(b,sin(b))
> hold;
> a=5
> gset arrow from a,0 to a,1
> 
> I get the error message "line 0: undefined variable: a".
> can anyone help? Is there a way to pass a variable to
> "gset arrow"?

Hello David,

try this:
octave:9> b=-10:10;
octave:10> plot(b,sin(b))
octave:11> hold;
octave:12> a=5;
octave:13> eval(sprintf("gset arrow from %d,0 to %d,1",a,a));
octave:14> replot

hope this helps,
Kai

-- 
Kai Habel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]