readline

Read line of ASCII string data from serial port

Description

example

data = readline(device) reads data until the first occurrence of the terminator and returns data as a string. The function blocks MATLAB waits until the terminator is reached or a timeout occurs.

Examples

collapse all

Read a string of ASCII data from the serial port.

s = serialport("COM3",9600);
configureTerminator(s,"CR");
data = readline(s);

Input Arguments

collapse all

Serial port, specified as a serialport object.

Example: serialport()

Output Arguments

collapse all

ASCII data read, returned as a string. The terminator is not included.

Introduced in R2019b