help-octave
[Top][All Lists]
Advanced

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

Re: Octave binary file format specification


From: David Bateman
Subject: Re: Octave binary file format specification
Date: Wed, 10 Nov 2004 14:15:50 +0100
User-agent: Mutt/1.4.1i

Paul,

I notice the code you are writing is for the old binary format. The
new format explicitly save the type name, as a 4-byte integer telling
the length of the typename and then a string with the type name. This
replaces the value "6" for the matrix type in your code. That being 
said the old format should work for backward compatiability reasons,
at least with the basic data types.

One of the 5 bytes you have that is unexplained is the type of the data.
This byte includes information on whether it is float/double/char, etc.
It is of type save_type which is an enum

enum save_type
  {
    LS_U_CHAR  = 0,
    LS_U_SHORT = 1,
    LS_U_INT   = 2,
    LS_CHAR    = 3,
    LS_SHORT   = 4,
    LS_INT     = 5,
    LS_FLOAT   = 6,
    LS_DOUBLE  = 7,
    LS_U_LONG  = 8,
    LS_LONG    = 9
  };

Information on this byte can be found in the function write_doubles, in
data-conv.cc. I'm not sure what the other bytes are.

The new binary load/save code is split into the part in ls-oct-binary.cc
that save the variable, its name, whether its global or not and its
documentation. The actually saving of the variables is then handled in
the save_binary function of each of the octave_value class.

If you don't want to rely on Matlabs format, then use the HDF5 format,
that can easily be used for matrix, complex matrix, structures, without
doing anything that is octave specific.. There was some sample HDF5 
code on the bugs list from Claude a few weeks ago to save a structure
of matrices. The bug associated with this is fixed in 2.1.61 and so
it might be used as an example code for exchange in the hdf5 format.

Regards
David

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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