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


bug #32090: Save in MATLAB data format

Submitted by:  Guillaume <gyom>
Submitted on:  Mon 10 Jan 2011 04:02:56 PM UTC  
Category: NoneSeverity: 5 - Blocker
Priority: 5 - NormalItem Group: Crash
Status: Need InfoAssigned to: David Bateman <dbateman>
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission 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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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 File(s):

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


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by hauberg (Updated the item)
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by dbateman (Posted a comment)
  • -unavailable- added by gyom (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 16 Jan 2011 09:47:54 PM UTCdbatemanOpen/ClosedOpen=>Closed
    Wed 12 Jan 2011 07:44:46 AM UTChaubergAttached File-=>Added a.mat, #22394
    Wed 12 Jan 2011 06:19:16 AM UTCjweSeverity3 - Normal=>5 - Blocker
    Tue 11 Jan 2011 10:36:40 PM UTCdbatemanStatusNone=>Need Info
      Assigned toNone=>dbateman
    Mon 10 Jan 2011 04:02:56 PM UTCgyomAttached File-=>Added a.mat, #22386

    Back to the top

    Powered by Savane 3.1-cleanup