bugGNU Octave - Bugs: bug #39827, "clear PATTERN" should...


bug #39827: "clear PATTERN" should not clear functions when PATTERN contains wildcards

Submitter:  Julien Bect <jbect>
Submitted:  Tue 20 Aug 2013 03:31:50 PM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Julien Bect Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Tue 22 Nov 2016 09:32:58 PM UTC, comment #1: 

This behavior is still present in Octave 4.2.0.

Hartmut <hardy>
Tue 20 Aug 2013 03:31:50 PM UTC, original submission:  

In Octave, `clear *' removes all variables and functions from the current workspace.

In Matlab (R2012a) `clear *' removes variables but not functions.

Similarly, if we assume that a function `g' is defined:

In Octave, both `clear g' and `clear g*' delete `g'.

In Matlab (R2012a), `clear g' deletes `g' but `clear g*' leaves `g' untouched.

The same is true for `?'.

As a general rule for describing this, I would say that `clear PATTERN' only affects variables (not functions), except for the special where 1) PATTERN contains no wildcards, and 2) PATTERN is not a variable name, in which case `clear PATTERN' can be seen as a shortcut for `clear functions PATTERN'.

I don't know if the is true in the most recent release of Matlab (R2013a) since the documentation of `clear' does not mention wildcards any more:


Julien Bect <jbect>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by jbect (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code