[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unclearable global variables?
From: |
John W. Eaton |
Subject: |
Re: Unclearable global variables? |
Date: |
Fri, 18 Mar 2005 03:03:39 -0500 |
On 18-Mar-2005, address@hidden <address@hidden> wrote:
| 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')
Maybe we should extend mlock/munlock/mislocked to allow "locking" of
global variables?
jwe
-------------------------------------------------------------
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
-------------------------------------------------------------