Specify the terminator character
You can configure
Terminator to an integer value ranging from 0 to 127, which represents the ASCII code for the character, or you can configure
Terminator to the ASCII character. For example, to configure
Terminator to a carriage return, you specify the value to be
13. To configure
Terminator to a line feed, you specify the value to be
10. You can also set
CR/LF, the terminator is a carriage return followed by a line feed. If Terminator is
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 of
\n are replaced with the
Terminator property value. Note that
%s\n is the default format for
fprintf. A read operation with
fscanf completes when the
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
An integer value ranging from 0 to 127, or the equivalent ASCII character.
LF/CR are also accepted values. You specify different read and write terminators as a 1-by-2 cell array.