From bug-octave-request at bevo dot che dot wisc dot edu Fri Dec 13 10:07:29 2002 Subject: Variables not being cleared From: Andrew Jackson To: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 13 Dec 2002 16:06:56 +0000 I'm not certain this is a bug, but it is certainly different behaviour between 2.1.36 and 2.1.40. I have two script files, one calling the other. The first sets up variables that I don't want to have to enter every time I call the second script. The second does an exist() on the variables to see if I need to enter them. The problem arises that having run the scripts once despite calling clear and checking the existance of the variables manually with who and exist (they have gone) when I rerun the script the variables, which are all defined as globals magically reappear with their previous values. Clear in 2.1.36 works and the variable *really* are cleared, whereas in 2.1.40 they only appear to have been cleared. An example: ---Script A--- global A B C A = 1; B = 2; scriptb ---End Script--- ---Script B--- global A B C if (!exist('A')) A = input('A: '); endif if (!exist('B')) B = input('B: '); endif if (!exist('C')) C = input('C: '); endif A B C ---End Script--- The octave session : octave:1> scripta C: 12 A = 1 B = 2 C = 12 octave:2> clear octave:3> who -variables octave:4> exist('A') ans = 0 octave:5> exist('B') ans = 0 octave:6> exist('C') ans = 0 octave:7> scripta A = 1 B = 2 C = 12 octave:8> Whereas 2.1.36 asks for C on the second run. Andrew -- Andrew J Jackson RKT Group Physical & Theoretical Chemistry Laboratory Oxford University ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------