I'm not sure I understand the question, but Søren's version seems to
work, at least under Octave 3.0.3 and Windows XP (I haven't tested it
under any other OS's).

octave-3.0.3.exe:6> ML_REFFREQ
ans =  440
octave-3.0.3.exe:7> ML_REFFREQ(437)
ans =  440
octave-3.0.3.exe:8> ML_REFFREQ
ans =  437

David.

On Tue, Jan 13, 2009 at 1:36 PM, Jonathan Kotta <[email protected]> wrote:
> On Fri, Jan 9, 2009 at 12:56 PM, Søren Hauberg <[email protected]> wrote:
>> Your accessor functions all seem to follow the same structure. An
>> example is 'ML_REFFREQ' which looks like this:
>>
>>    mlock();
>>    try
>>        ml_reffreq;
>>    catch
>>        persistent ml_reffreq = 440;
>>    end
>>    old = ml_reffreq;
>>    if (nargin == 1)
>>        ml_reffreq = new;
>>    endif
>>
>> I don't see why you need the try-catch block. Doesn't the following
>> work:
>>
>>    mlock();
>>    persistent ml_reffreq = 440;
>>    old = ml_reffreq;
>>    if (nargin == 1)
>>        ml_reffreq = new;
>>    endif
>>
>> ?
>
> Doesn't that always set the value to the default, unless you give it a
> new value?  Then you can't read the current value without making it
> global.
>
> --
> Thanks,
>
> Jonathan Kotta
>
> Hofstadter's Law:
>    It always takes longer than you expect, even
>    when you take into account Hofstadter's Law.
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to