Matlab matrix support

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Matlab matrix support

Jaroslav Fojtík
Dears,

I have implemented .mat reader for GraphicMagick.

Is anybody here, who has matlab matrix created in High
(motorola) endian? Or is octave abble to create/load this
reversed endian matrix?

thank you very much
   J.Fojtik





-------------------------------------------------------------
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 | Threaded
Open this post in threaded view
|

Re: Matlab matrix support

David Bateman-3
Fojtik Jaroslav wrote:

>Dears,
>
>I have implemented .mat reader for GraphicMagick.
>
>Is anybody here, who has matlab matrix created in High
>(motorola) endian? Or is octave abble to create/load this
>reversed endian matrix?
>
>thank you very much
>   J.Fojtik
>
>  
>
The matrix matrix format always saves in the native format, with a flag
for the endianness in the header of the file. Octave respects this
endianness flag and  inverses the endianness where necessary.

D.

--
David Bateman                                [hidden email]
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

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 | Threaded
Open this post in threaded view
|

Re2: Matlab matrix support

Jaroslav Fojtik
Dear David,

>The matrix matrix format always saves in the native format, with a flag
>for the endianness in the header of the file. Octave respects this
>endianness flag and  inverses the endianness where necessary.

  Thank you. So if I compile Octave on Solaris I could obtain a matrix
I am asking for.

Anyway, are you also planning to support matrices from Matlab 7.1?
They are same as previous, but gzipped. May be, that I probe this and
when I succeed, you could copy&past my code.

Jara

PS: Data Compression
MATLAB compresses the data it saves to a MAT-file using buffered in-memory
gzip compression. It compresses MATLAB variables transparently as they are
written out to disk. This technique uses less memory than systems that
compress an entire variable at once before writing it out to disk. Also, no
temporary files are required in order to read or write compressed data.
Because it compresses each variable individually, MATLAB can read a
compressed MAT-file like any other MAT-file. No code changes are required at
either the C or M level to read a compressed MAT-file.

MATLAB compresses data for MAT-files (file I/O) only, not for sequential
streams. The reason for this is that the size of the compressed variable is
known only after it is compressed, but it must be written in the tag at the
beginning of the variable. In a file it is possible to seek back and write the size,
while in a stream this cannot be done.

MAT-files containing compressed variables are non-platform specific like any
MAT-file, and such a file saved on any MATLAB supported platform can be
loaded on any other supported platform.

To decompress the contents of a compressed variable in a MAT-file, you can use
the uncompress function from the freeware zlib-1.1.4 library available at the
gzip web site, http://www.gzip.org/zlib/. Once a MATLAB array has been
decompressed, you can ignore the miCOMPRESSED tag and process the data
normally, as if it had not been compressed.
Note To disable data compression when writing to MAT-files, see "Saving
and Loading MAT-files" in the "Data Import and Export" chapter of the
MATLAB Programming documentation.

Storing Compressed Data
MATLAB stores compressed data in gzip-compressed MATLAB arrays. Each
compressed variable is stored complete with its tags and data field in the same
format as uncompressed variables, as described in "Data Element Format" on
page 1-8. The difference is that the entire variable is compressed into a data
buffer, and this buffer is preceded by an 8-byte tag named miCOMPRESSED. The
tag contains the length of the compressed buffer.


--------------------------------------------------------------------
Jaroslav Fojtik                                      HUMUSOFT s.r.o.
[hidden email]                                  Pobrezni 20
http://www.humusoft.com                              186 00 Praha 8
tel: ++ 420 2 84011730                               Czech Republic
fax: ++ 420 2 84011740
--------------------------------------------------------------------



-------------------------------------------------------------
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 | Threaded
Open this post in threaded view
|

Re2: Matlab matrix support

John W. Eaton-6
On 28-Mar-2006, Jaroslav Fojtik wrote:

| Anyway, are you also planning to support matrices from Matlab 7.1?
| They are same as previous, but gzipped.

This has already been done for Octave 2.9.x.

jwe



-------------------------------------------------------------
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 | Threaded
Open this post in threaded view
|

Re: Re2: Matlab matrix support

David Bateman-3
In reply to this post by Jaroslav Fojtik
Jaroslav Fojtik wrote:

>Dear David,
>
>  
>
>>The matrix matrix format always saves in the native format, with a flag
>>for the endianness in the header of the file. Octave respects this
>>endianness flag and  inverses the endianness where necessary.
>>    
>>
>
>  Thank you. So if I compile Octave on Solaris I could obtain a matrix
>I am asking for.
>  
>
If the solaris is running on a big endian machine..

>Anyway, are you also planning to support matrices from Matlab 7.1?
>They are same as previous, but gzipped. May be, that I probe this and
>when I succeed, you could copy&past my code.
>  
>
Matrices from 7.1 are supported in 2.9, though I only wish mathworks did
just gzip the files as just using gzopen instead of the bastard
partially zipped and unzipped format they used that made me have to
allocate additional memory in the code to read their files. It also
makes backward compatiability impossible as if it was just a gzipped
file, running "gzip -d" on the Matlab v7 file would turn it into a
Matlab v6 file.. This was a stupid design choice in my opinion.

The octave code can also read UTF-8 files, but can't read the other UTF
types supportted in Matlab v7.1..

D.

--
David Bateman                                [hidden email]
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax)

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
-------------------------------------------------------------