help-octave
[Top][All Lists]
Advanced

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

Re: clearing global variables


From: Michael Johnson
Subject: Re: clearing global variables
Date: Wed, 6 Oct 2010 17:32:44 -0500

Thanks Dmitri,

Unfortunately that didn't work:
octave:1> global VAR = 1;
octave:2> clear VAR
octave:3> global VAR = 0;
octave:4> VAR
VAR =  1

Here's a lame workaround that I came up with - included for the archives.

octave:1> global VAR; VAR = 1;
octave:2> clear all
octave:3> VAR
error: `VAR' undefined near line 3 column 1
octave:3> global VAR; VAR = 0;
octave:4> VAR
VAR = 0

So, for future reference, does this list expect people to be using the development code (aka 3.3.52). If so, is there a plan for an official release soon? I deliver octave simulations to customers who are unwilling or unable to compile octave themselves.

Mike

On Wed, Oct 6, 2010 at 5:12 PM, Dmitri A. Sergatskov <address@hidden> wrote:
On Wed, Oct 6, 2010 at 5:00 PM, Michael Johnson
<address@hidden> wrote:
> Hi,
>
> I'm new to this list, so please forgive me if this has been discussed. I
> searched through the mailing list history, but found no recent discussions
> of this issue.
>
> I am using octave 3.2.4 on Fedora 11, and I'm unable to clear global
> variables. I have a few questions: Am I doing something wrong? Is this
> intended behavior? Is this a bug? Here's some example code:
>
> octave:1> global VAR = 1;
> octave:2> clear all
> octave:3> global VAR = 0;
> octave:4> VAR
> VAR =  1
>
> I would really think VAR would be redefined to be 0 after the clear all...
>
> Thanks,
> Mike

I suspect in your version of octave "clear" does not interpret "all"
as a special keyword and instead is trying to clear variable with
name "all". It has been fixed in later version. It works as expected
on octave 3.3.52+ on my computer.  You can do
"clear VAR" as a workaround.

Sincerely,

Dmitri.
--


reply via email to

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