help-octave
[Top][All Lists]
Advanced

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

Re: Saving matrices in octave binary format from f90


From: David Bateman
Subject: Re: Saving matrices in octave binary format from f90
Date: Fri, 04 Mar 2005 12:42:04 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

address@hidden wrote:

Dear all,
I would like to know if (and how) it is possible to save complex vectors and complex matrices in octave binary format directly from fortran90. I use intel fortran compiler (waiting for the release of GCC4.0 and gfortran) under Debian.
Best
regards



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

Paul Laub sent a c code snippet to save in a matrix in the binary format. See the message

http://www.octave.org/mailing-lists/help-octave/2004/2623

In the following messages in the thread I explained the bits of this format he was uncertain of. See

http://www.octave.org/mailing-list/help-octave/205/2634

That is the four-bytes, FE FF FF FF that he was unsure of is the value -2 in little-endian, as the file is marked with the header "Octave-1-L". If he'd marked it with a "B" instead of an "L", the -2 would have to be in big-endan format. The absolute value of the -2 is the number of dimensions in the matrix, and the following values are the dimensions.

As for the other byte that Paul couldn't identify, it comes from the file data-conv.h that defines the data type used to save the values in the file. Paul's code forces them to be doubles, but in some cases they might be floats or integers, and flagged differently as specificed in data-conv.h

In any case Paul's message above will give you a good start on saving to a binary format.

Regards
David



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