bugGNU Octave - Bugs: bug #30800, impossible to save single...


bug #30800: impossible to save single precision variables in matlab binary format

Submitter:  George Dahl <t_gdahl>
Submitted:  Tue 17 Aug 2010 09:38:52 PM UTC
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  dbateman
Originator Name:  Open/Closed:  * Closed
Release:  * 3.2.4 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Tue 24 Aug 2010 08:03:25 PM UTC, comment #7: 

Ok I pushed the change and am closing this bug

David Bateman <dbateman>
Group Member
Sun 22 Aug 2010 11:51:56 PM UTC, comment #6: 

The patch works for me.  It would also be good for the original reporter to test some complex, "single" matrices as my original script didn't test for those.

Rik <rik5>
Group administrator
Sun 22 Aug 2010 02:00:40 PM UTC, comment #5: 

Seems like an over sight when I implemented the single precision type. This type of feature needs a bit of test with files passed back and forth between Octave and Matlab to ensure that the feature is implemented in a compatible manner. I no loner have access to matlab though with the Mat-files you attached I made a first attempt at implementing this feature with the attached patch.

There is quite a bit of code duplication and a few C++ templates could probably clean this up a bit, but it seems to work for me.

Could you test this code a bit more extensively with files passed from Matlab to Octave and vis-a-versa and see if it works correctly


(file #21273)

David Bateman <dbateman>
Group Member
Fri 20 Aug 2010 08:40:51 PM UTC, comment #4: 

Sorry, something went wrong when I posted the first comment and the file was never attached.  It is now on the bug tracker.

Rik <rik5>
Group administrator
Fri 20 Aug 2010 08:15:11 PM UTC, comment #3: 

So far no files are attached to the report.

George Dahl <t_gdahl>
Thu 19 Aug 2010 02:28:16 PM UTC, comment #2: 

To help determine the difference in formats could you run the script mk_v6v7_files.m on MatLab.  I am attaching the script to this bug report.  It will produce two files (varV7.mat, varV6.mat) which I would like to have you upload so I can spot differences between single and double variables in the formats.

Rik <rik5>
Group administrator
Thu 19 Aug 2010 04:35:03 AM UTC, comment #1: 

This bug is confirmed on a recent development tip (8/18/10).

In the meantime, here are two workarounds: 1) Use Octave formats (-text or -float-binary), 2) cast the required variables back to single on re-loading them (single(VARNAME)).

Rik <rik5>
Group administrator
Tue 17 Aug 2010 09:38:52 PM UTC, original submission:  

When one saves a single precision matrix with matlab binary format (tried both -v6 and -mat7-binary) the matrix is upcasted to double precision. If one does this in matlab, however, the matrix will remain single precision when reloaded (and while on disk). Furthermore, there is no documented option in save that allows saving of single precision matrices in any matlab binary format.

George Dahl <t_gdahl>


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

Attach Files:

Attached Files
file #21273:  patch.single added by dbateman (13KiB - application/octet-stream)
file #21265:  varV6.mat added by t_gdahl (280B - application/octet-stream - files generated by mk_v6v7_files.m on 64 matlab on windows 7)
file #21266:  varV7.mat added by t_gdahl (245B - application/octet-stream - files generated by mk_v6v7_files.m on 64 matlab on windows 7)
file #21264:  mk_v6v7_files.m added by rik5 (89B - application/octet-stream)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by dbateman (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by t_gdahl (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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-28 dbateman Dependencies- bugs #31942 is dependent
    2010-08-24 dbateman StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2010-08-22 dbateman StatusConfirmed In Progress
        Assigned toNone dbateman
    2010-08-22 dbateman Attached File- Added patch.single, #21273
    2010-08-20 t_gdahl Attached File- Added varV6.mat, #21265
        Attached File- Added varV7.mat, #21266
    2010-08-20 rik5 Attached File- Added mk_v6v7_files.m, #21264
    2010-08-19 rik5 CategoryNone Interpreter
        Severity3 - Normal 1 - Wish
        Item GroupNone Feature Request
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code