octave-maintainers
[Top][All Lists]
Advanced

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

Re: OOP and load/save


From: John W. Eaton
Subject: Re: OOP and load/save
Date: Thu, 23 Apr 2009 12:06:01 -0400

On 23-Apr-2009, Judd Storrs wrote:

| Taking the example further change @Foo/Foo.m to
| 
| function f = Foo(f)
|   f = class(f, 'Foo');
| 
| Then in matlab:
| 
| >> load test.mat
| Warning: Could not determine the fields for class Foo by calling the
|          constructor with no input arguments.  The object a has been
|          converted to a structure.  To eliminate the conversion create
|          an object of class Foo before calling LOAD.
| >> f.dataelement = 'I am Foo';
| >> f = Foo(f);
| >> load test.mat
| >> bar
| 
| bar =
| 
|     Foo object: 1-by-1
| 
| Ok, restart matlab
| 
| >> f.notdataelement = 'I am not Foo';
| >> f = Foo(f);
| >> load test.mat
| Warning: Fields of object 'bar' do not match the current constructor
|          definition for class 'Foo'.  The object has been converted
|          to a structure.

What happens if you actually change the @Foo/Foo.m file itself to
modify the fields in the class while Matlab is still running, and then
reload the file?  Does Matlab notice that the constructor definition has
changed and also complain about that?

jwe


reply via email to

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