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

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

[Octave-bug-tracker] [bug #35881] clear all removes subfunctions


From: Julien Bect
Subject: [Octave-bug-tracker] [bug #35881] clear all removes subfunctions
Date: Tue, 03 May 2016 11:55:41 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Follow-up Comment #7, bug #35881 (project octave):

JWE asked (see comment #3):
> What does Matlab remove when "clear all" appears inside a function? [...]
Does it clear local variables defined inside the current function?

The documentation clearly states that "clear" or "clear all" removes all
variables from the current workspace.

http://fr.mathworks.com/help/matlab/ref/clear.html

Here is a little experiment to confirm (R2016a):

>> type test_clear_localvariables.m
function test_clear_localvariables ()
x = 1;
clear all
disp (x)
end

>> test_clear_localvariables
Reference to a cleared variable x.

Error in test_clear_localvariables (line 4)
disp (x)


Octave (test in 4.0.2) does the same (although with a less explicit error
message):

>> test_clear_localvariables
error: 'x' undefined near line 4 column 8
error: called from
    test_clear_localvariables at line 4 column 2
error: evaluating argument list element number 1
error: called from
    test_clear_localvariables at line 4 column 2


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

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