bugGNU Octave - Bugs: bug #45893, classdef properties are not...


bug #45893: classdef properties are not reloaded on "clear"

Submitter:  antonkulaga <antonkulaga>
Submitted:  Mon 07 Sep 2015 08:47:49 AM UTC
Category:  Octave Function Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Mon 14 Sep 2015 09:21:54 PM UTC, comment #3: 

As per the warning message, Matlab detects that the class was modified and that undefined behavior may occur until you "clear" any instances of that class. After "clear", the new defn is used.

I think the difference between ML and Octave is that "clear" is sufficient in Matlab whereas "clear classes" is required in Octave. Plus, no warning message.

Ceral Paquet <octavebugs>
Sat 12 Sep 2015 09:48:44 PM UTC, comment #2: 

Is this a Matlab compatibility issue or just a user misunderstanding? Does Matlab automatically reload class properties when files are modified, or is a "clear <something>" required?

Mike Miller <mtmiller>
Project Administrator
Mon 07 Sep 2015 05:39:34 PM UTC, comment #1: 

If you 'clear all' (or clear -classes) then it looks like Octave picks up the new class properties. In Matlab a 'clear' is sufficient.


>> f=classfoo()

f =

  classfoo with properties:

     bar: 'value'
    bar2: 1

%% Now modify the classfoo.m file to add a new property.

>> g=classfoo()

Warning: The class file for 'classfoo' has been changed, but the change cannot be applied because objects based on the
old class file still exist. If you use those objects, you might get unexpected results. You can use the 'clear'
command to remove those objects. See 'help clear' for information on how to remove those objects.

g =

  classfoo with properties:

     bar: 'value'
    bar2: 1

>> clear
>> g=classfoo()

g =

  classfoo with properties:

     bar: 'value'
    bar2: 1
    bar3: 'test'

Ceral Paquet <octavebugs>
Mon 07 Sep 2015 08:47:49 AM UTC, original submission:  

I cannot work with classdefs in Octave GUI because they are cached.

When I create and save a class with several properties and save it and then use it in the console the class is cached somewhere. When I add some new properties or change values of current ones I do not see such changes from octave console (inside GUI), so new props are not added, old props are not changed. It is a serious problem that forces me to move to Matlab in my project that I really do not want to do =((((

To reproduce the proble create a class

classdef foo
    bar = 'value'

then save the file and to console
$ myfoo = foo()

You will get 'value" for the bar. But then if you will add several other properties to the class they will not be found and if you change bar value in class description it will still display the oldone.

antonkulaga <antonkulaga>


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

Attach Files:

No files currently attached


Carbon-Copy List
  • -email is unavailable- added by octavebugs (Posted a comment)
  • -email is unavailable- added by antonkulaga (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 project members can vote.





    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-12 mtmiller Dependencies- bugs #55887 is dependent
    2019-03-11 mtmiller Severity3 - Normal 1 - Wish
        Item GroupMatlab Compatibility Feature Request
        StatusNeed Info Confirmed
        Summaryclassdef properties are not reloaded when file is updated classdef properties are not reloaded on "clear"
    2019-03-11 mtmiller Carbon-CopyRemoved 80942 -
    2015-09-12 mtmiller Item GroupWTF, Matlab?!? Matlab Compatibility
        StatusNone Need Info
        Release4.0.0 dev
        Summaryclassdefs are cached by GUI classdef properties are not reloaded when file is updated

    Back to the top

    Powered by Savane 3.9