[Top][All Lists]

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

Global Variables

From: sandro
Subject: Global Variables
Date: Tue, 7 Feb 1995 13:01:49 +0100 (MET)

I can't make out this behaviour of global variables; it seems like if "f"
is seen just the first time.

octave:1> global f=6
octave:2> function retval=g(x)
>   global f
>   if (x<=10)
>      retval=x;
>   else
>      retval=g(x-f);
>   endif
> endfunction
octave:3>  g(3)
ans = 3
octave:4> g(13)
ans = 7
octave:5> g(22)
error: `f' undefined near line 6 column 17

A second problem is that if the answer of a funcion is a long vector (eg.:
1000 elements) requiring a pager (I use less) if I exit the pager (q)
octave aborts with the message:
broken pipe
Broken pipe

I'm a real beginner and apologie if my problems are just lack of practice.
I'm using Octave 1.0 with linux 1.0.9

Thanks in advance

Sandro Dentella 

reply via email to

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