On Tue, Jan 6, 2009 at 11:12 PM, Bill Denney <wslo...@gmail.com> wrote:
>
> Global and persistent variables are cleared with clear all.
>

You can write an accessor function and mlock it to preserve global variables.

function old = my_variable_accessor(new)
    mlock();

    try
        val;
    catch
        persistent val;
        val = DEFAULT;
    end

    old = val;

    if nargin == 1
        val = new;
    end

-- 
Thanks,

Jonathan Kotta

Hofstadter's Law:
    It always takes longer than you expect, even
    when you take into account Hofstadter's Law.

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to