| www.delorie.com/gnu/docs/octave/octave_121.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Octave can read and write binary data using the functions fread
and fwrite, which are patterned after the standard C functions
with the same names. The are able to automatically swap the byte order
of integer data and convert among ths supported floating point formats
as the data are read.
The optional argument size specifies the amount of data to read and may be one of
Inf
nr
[nr, Inf]
[nr, nc]
nr * nc elements, returning a matrix with
nr rows. If the number of elements read is not an exact multiple
of nr, the last column is padded with zeros.
If size is omitted, a value of Inf is assumed.
The optional argument precision is a string specifying the type of data to read and may be one of
"char"
"char*1"
"integer*1"
"int8"
"signed char"
"schar"
"unsigned char"
"uchar"
"short"
"unsigned short"
"ushort"
"int"
"unsigned int"
"uint"
"long"
"unsigned long"
"ulong"
"float"
"float32"
"real*4"
"double"
"float64"
"real*8"
"integer*2"
"int16"
"integer*4"
"int32"
The default precision is "uchar".
The optional argument skip specifies the number of bytes to skip before each element is read. If it is not specified, a value of 0 is assumed.
The optional argument arch is a string specifying the data format for the file. Valid values are
"native"
"ieee-le"
"ieee-be"
"vaxd"
"vaxg"
"cray"
Conversions are currently only supported for "ieee-be" and
"ieee-le" formats.
The data read from the file is returned in val, and the number of
values read is returned in count
The argument data is a matrix of values that are to be written to the file. The values are extracted in column-major order.
The remaining arguments precision, skip, and arch are
optional, and are interpreted as described for fread.
The behavior of fwrite is undefined if the values in data
are too large to fit in the specified precision.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |