/usr/share/freemat/help/text/fread.mdc is in freemat-help 4.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | FREAD FREAD File Read Function
Usage
Reads a block of binary data from the given file handle into a variable
of a given shape and precision. The general use of the function is
A = fread(handle,size,precision)
The handle argument must be a valid value returned by the fopen
function, and accessable for reading. The size argument determines
the number of values read from the file. The size argument is simply
a vector indicating the size of the array A. The size argument
can also contain a single inf dimension, indicating that FreeMat should
calculate the size of the array along that dimension so as to read as
much data as possible from the file (see the examples listed below for
more details). The data is stored as columns in the file, not
rows.
Alternately, you can specify two return values to the fread function,
in which case the second value contains the number of elements read
[A,count] = fread(...)
where count is the number of elements in A.
The third argument determines the type of the data. Legal values for this
argument are listed below:
- 'uint8','uchar','unsigned char' for an unsigned, 8-bit integer.
- 'int8','char','integer*1' for a signed, 8-bit integer.
- 'uint16','unsigned short' for an unsigned, 16-bit integer.
- 'int16','short','integer*2' for a signed, 16-bit integer.
- 'uint32','unsigned int' for an unsigned, 32-bit integer.
- 'int32','int','integer*4' for a signed, 32-bit integer.
- 'single','float32','float','real*4' for a 32-bit floating point.
- 'double','float64','real*8' for a 64-bit floating point.
Starting with FreeMat 4, the format for the third argument has changed.
If you specify only a type, such as 'float', the data is read in as
single precision, but the output type is always 'double'. This behavior
is consistent with Matlab. If you want the output type to match the input
type (as was previous behavior in FreeMat), you must preface the precision
string with a '*'. Thus, the precision string '*float' implies
that data is read in as single precision, and the output is also single
precision.
The third option is to specify the input and output types explicitly.
You can do this by specifiying a precision string of the form
'type1 => type2', where 'type1' is the input type and
'type2' is the output type. For example, if the input type is
'double' and the output type is to be a 'float', then a type spec
of 'double => float' should be used.
|