octave-maintainers
[Top][All Lists]
Advanced

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

Re: OOP and load/save


From: Judd Storrs
Subject: Re: OOP and load/save
Date: Thu, 23 Apr 2009 11:46:23 -0400

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.


--judd


reply via email to

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