help-octave
[Top][All Lists]
Advanced

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

Re2: Matlab matrix support


From: Jaroslav Fojtik
Subject: Re2: Matlab matrix support
Date: Tue, 28 Mar 2006 06:19:11 -0600

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.
address@hidden                                  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 via email to

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