bugGNU Octave - Bugs: bug #32641, Load of MAT-files that contain...

 
 

bug #32641: Load of MAT-files that contain objects

Submitted by:  Guillaume <gyom>
Submitted on:  Tue 01 Mar 2011 06:46:06 PM UTC  
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  David Bateman <dbateman>
Originator Name:  Guillaume Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 02 Jun 2011 07:08:04 PM UTC, comment #7: 

The fix for MAT-files only has been checked in on the development branch (http://hg.savannah.gnu.org/hgweb/octave/rev/c0d102ad9bba)

Rik <rik5>
Project Administrator
Wed 01 Jun 2011 11:13:44 PM UTC, comment #6: 

The Octave load/save code probes the value type, then creates a dummy variable of this type with

octave_value tc = octave_value_typeinfo::lookup_type (typ);

before finally calling for example

tc.load_ascii (is);

So even before we get to the load_ascii call in ov-class.cc the type of the variable is fixed and mutating the varible to a structure after calling the examplar fails can not be performed there. The mutation has to be perform when we're back from the call to load_ascii. I don't see an easy means of doing this without significant chznges to the API of load_ascii, etc

In any case that shouldn't stop the patch for the matfile version of this problem being applied.

D,

David Bateman <dbateman>
Project MemberIn charge of this item.
Tue 19 Apr 2011 02:03:52 AM UTC, comment #5: 

Your current patch works, but only applies to .mat files.  Wouldn't it make sense to have this conversion for Octave files as well?

I just tried saving an instance of the 'Snork' class using run-octave in the development directory.  If I transfer this file outside of the development directory and then run an ordinary version of Octave I get the "no constructor" warning and there is nothing I can do with the object.  This is with Octave's own text save format.

Rik <rik5>
Project Administrator
Sun 17 Apr 2011 06:50:45 PM UTC, comment #4: 

It is really not easy for me to commit at the moment as I only have an anonymous checkout, and thats at work. I'd be happy if you commit and close this bug

D.

David Bateman <dbateman>
Project MemberIn charge of this item.
Sat 02 Apr 2011 02:57:10 AM UTC, comment #3: 

Since this patch appears to work, is there any reason not to apply it to the development code?

Rik <rik5>
Project Administrator
Tue 08 Mar 2011 07:15:32 PM UTC, comment #2: 

David,

it seems to work for me so that would be great if you could commit this change - if it could be applied to the 3.4 branch, that would be great too.

Thanks.

Guillaume <gyom>
Fri 04 Mar 2011 11:14:23 PM UTC, comment #1: 

Completely untested, but the attached should do what you want

D.

(file #22839)

David Bateman <dbateman>
Project MemberIn charge of this item.
Tue 01 Mar 2011 06:46:06 PM UTC, original submission:  

In MATLAB, when loading a MAT-file containing an object whose class in not in the path, one gets the warning:

MATLAB:elementsNowStruc
Element(s) of class 'myclass' do not match the current constructor definition.  The element(s) have been converted to structures.

while with Octave, one gets:

warning: no constructor for class myclass

and, importantly, the variable is still an object of class myclass (in MATLAB, it is a simple struct as expected).

Could an automatic conversion to a structure be implemented in such case?

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #22839:  changeset.class added by dbateman (2KiB - application/java-vm)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dbateman (Updated the item)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-06-02 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2011-06-01 dbateman Assigned toNone => dbateman
    2011-04-02 rik5 StatusNone => Patch Submitted
    2011-03-04 dbateman Attached File- => Added changeset.class, #22839

    Back to the top


    Powered by Savane 3.5