help-octave
[Top][All Lists]
Advanced

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

Re: Unclearable global variables?


From: pkienzle
Subject: Re: Unclearable global variables?
Date: Fri, 18 Mar 2005 07:55:53 +0000

The following should work but I haven't tested it:

function r=var(x)
  mlock
  persistent z = 'default';
  if nargin, z=x; end
  r = z;
end


You can reference it as if it were a variable, e.g., 

    y = var;

but to set it to a new value you need to do

    var('value')

- Paul


> 
> Is there a way to mark a global variable "unclearable" ?  
> 
> I am developping a toolbox.  Some aspects of it are controlled by a
> few global variables.  Issuing a "clear" command, well, clears them.
> And annoys me.
> 
> TIA,
> JFC.
> 
> 
> 
> -------------------------------------------------------------
> 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
> -------------------------------------------------------------
> 



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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