Read one binblock of data from serial port
reads a binblock of data interpreted as the type specified by
data = readbinblock(
For numeric types, the data is returned as a 1-by-N array of doubles. For text types, the
data is returned as character vector or string, as specified.
The function blocks MATLAB and waits until a binblock is read from the serial port.
Read a binblock of numeric uint8 data from the serial port.
The default precision is uint8.
s = serialport("COM3",9600); data = readbinblock(s);
Read a binblock of numeric uint16 data from the serial port.
s = serialport("COM3",9600); data = readbinblock(s,"uint16")
device— Serial port
Serial port, specified as a
precision— Size and format of each value
Size and format of binblock data, specified as a character vector or string.
precision determines the number of bits to read for each value and
the interpretation of those bits as a MATLAB data type.
data— Numeric or ASCII data
Numeric or ASCII data, returned as a 1-by-N vector of doubles or text. For all
data is a row vector of
double values. For the text type
precision values of
of the specified type.