octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #42126] persistent variable is inaccessible fr


From: sergey plotnikov
Subject: [Octave-bug-tracker] [bug #42126] persistent variable is inaccessible from within a nested function
Date: Tue, 15 Apr 2014 17:05:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?42126>

                 Summary: persistent variable is inaccessible from within a
nested function
                 Project: GNU Octave
            Submitted by: nul0m
            Submitted on: Tue 15 Apr 2014 05:05:05 PM GMT
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux

    _______________________________________________________

Details:

The following function works in Matlab but doesn't in Octave.


function accessPersistVarFromNested
persistent myVar
disp(myVar);
myVar = randn;
myNested;
  function myNested
    disp(myVar);
  end
end


Below is the Octave error message:


>> accessPersistVarFromNested
 0.82211
error: 'myVar' undefined near line 14 column 10
error: evaluating argument list element number 1
error: called from:
error:   /myPlace/accessPersistVarFromNested.m at line 14, column 5
error:   /myPlace/accessPersistVarFromNested.m at line 8, column 1


Matlab has no problem accessing _myVar_ when inside _myNested()_, so I'm
wondering if current Octave behavior was really meant.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42126>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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