bugGNU Octave - Bugs: bug #32090, Save in MATLAB data format


bug #32090: Save in MATLAB data format

Submitter:  Guillaume <gyom>
Submitted:  Mon 10 Jan 2011 04:02:56 PM UTC
Category:  None Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Need Info Assigned to:  dbateman
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Mon 17 Jan 2011 01:52:45 PM UTC, comment #7: 

It works for me as well, thanks David!

Guillaume <gyom>
Sun 16 Jan 2011 09:47:54 PM UTC, comment #6: 

Ok so it appears to work fine.. Closing this bug


David Bateman <dbateman>
Group Member
Fri 14 Jan 2011 07:28:31 AM UTC, comment #5: 

With Matlab (R2010a) 32-bit (glnx86) and Doug's file from comment 4 I get

>> load a.mat
>> whos

  Name         Size               Bytes  Class     Attributes

  a         1000x1000            123488  double    sparse   
  b         1000x1000            123524  double    sparse   


Søren Hauberg <hauberg>
Fri 14 Jan 2011 12:28:40 AM UTC, comment #4: 

Hi David

I don't have Matlab but I did make the file with a new tip.
the file is here:

If some one would try this with Matlab and report here then all will be happy
Doug Stewart

Doug Stewart <dastew>
Thu 13 Jan 2011 09:52:21 PM UTC, comment #3: 

I'm not sure this is a blocker as the case of nnz not being equal to nzmax should be relatively rare in practice. However the changeset


seems to do the right thing for me.. Could some one, with a freshly checked and built octave run

a = sprand(1000,1000,0.01);
b = sprandn(1000,1000,0.01);
save -v6 a.mat a b

and then try and load the saved file in matlab? I'll keep this report open till I have that feedback.


David Bateman <dbateman>
Group Member
Wed 12 Jan 2011 07:44:46 AM UTC, comment #2: 


a = spalloc (2,2,4); s(1,1) = 1; s(2,2) = 2;
b = 1;
save -v6 a.mat a b

gives me the attached file.

(file #22394)

Søren Hauberg <hauberg>
Tue 11 Jan 2011 10:36:40 PM UTC, comment #1: 

I think I see the issue. Octave recently changed so that you could create a sparse matrix and then fill it without reallocating memory at each assignment, and as a result removed the assumption that nnz = nzmax in octave. Changes were made in a number of places to handle this change, but the matlab file format in this case was unclear from the documentation and I made a guess on how matlab treated the case of nnz not equaling nzmax (as I no longer have access to matlab) it appears that this guess was wrong.

The simpler example

a = spalloc (2,2,4); s(1,1) = 1; s(2,2) = 2;
b = 1;
save -v6 a.mat a b

demonstrates this error more easily.. To make my life easier could you run the above in matlab and upload the saved file so I can compare what matlab does in this case.


David Bateman <dbateman>
Group Member
Mon 10 Jan 2011 04:02:56 PM UTC, original submission:  

This is a follow-up from previous bug report:

The attached a.mat MATLAB v5 MAT-file was created with MATLAB.
The following crashes with Octave dev:

  octave> load a.mat
  octave> save a.mat a -v6
  octave> load a.mat
  error: load: invalid element type = 58368

while it seems to work with Octave 3.2.4.

Guillaume <gyom>


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

Attach Files:

Attached Files
file #22394:  a.mat added by hauberg (288B - application/octet-stream)
file #22386:  a.mat added by gyom (90KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by dastew (Posted a comment)
  • -email is unavailable- added by hauberg (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by dbateman (Posted a comment)
  • -email is unavailable- added by gyom (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.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-01-16 dbateman Open/ClosedOpen Closed
    2011-01-12 hauberg Attached File- Added a.mat, #22394
    2011-01-12 jwe Severity3 - Normal 5 - Blocker
    2011-01-11 dbateman StatusNone Need Info
        Assigned toNone dbateman
    2011-01-10 gyom Attached File- Added a.mat, #22386

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code