Specify terminator character
For serial, TCPIP, UDP, and VISA-serial objects, you can configure
an integer value ranging from
to the equivalent ASCII character, or to empty (''). For example,
Terminator to a carriage return,
you specify the value to be
Terminator to a line feed, you specify
the value to be
serial port objects, you can also set
terminator is a carriage return followed by a line feed. If Terminator
LF/CR, the terminator is a line feed followed
by a carriage return. Note that there are no integer equivalents for
these two values.
Additionally, you can set
Terminator to a
1-by-2 cell array. The first element of the cell is the read terminator
and the second element of the cell array is the write terminator.
When performing a write operation using the
fprintf function, all occurrences
\n are replaced with the
%s\n is the default format for
A read operation with
Terminator value is read. The terminator
is ignored for binary operations.
You can also use the terminator to generate a bytes-available
event when the
BytesAvailableFcnMode is set to
Serial, TCPIP, UDP, VISA-serial
An integer value ranging from
the equivalent ASCII character, or empty (''). For serial port objects,
also accepted values. You specify different read and write terminators
as a 1-by-2 cell array.
This example shows how to set the terminator for a serial port object.
Create a serial port object associated with the COM1 port. The oscilloscope you are connecting to over the serial port is configured to a baud rate of 9600 and a carriage return terminator, so set the serial port object to those values.
s = serial('COM1'); s.Baudrate = 9600; s.Terminator = 'CR';