Read binary data from device
A = fread(obj)
A = fread(obj,size
,'precision
')
[A,count] = fread(...)
[A,count,msg] = fread(...)
A = fread(obj)
and A
= fread(obj,size)
read binary data from the device connected
to the serial port object, obj
, and returns the
data to A
. The maximum number of values to read
is specified by size
. If size
is
not specified, the maximum number of values to read is determined
by the object's InputBufferSize
property. Valid
options for size
are:
| Read at most |
| Read at most m-by-n values filling an m–by–n matrix in column order. |
size
cannot be inf
, and
an error is returned if the specified number of values cannot be stored
in the input buffer. You specify the size, in bytes, of the input
buffer with the InputBufferSize
property. A value
is defined as a byte multiplied by the precision
(see
below).
A = fread(obj,
reads binary data with precision specified by size
,'precision
')precision
.
precision
controls the number of
bits read for each value and the interpretation of those bits as integer,
floating-point, or character values. If precision
is
not specified, uchar
(an 8-bit unsigned character)
is used. By default, numeric values are returned in double-precision
arrays. The supported values for precision
are
listed below in Tips.
[A,count] = fread(...)
returns
the number of values read to count
.
[A,count,msg] = fread(...)
returns
a warning message to msg
if the read operation
was unsuccessful.
BytesAvailable
| BytesAvailableFcn
| fgetl
| fgets
| fopen
| fscanf
| InputBufferSize
| Status
| Terminator
| ValuesReceived