User`s manual

Writing and Reading Data
8-31
For example, since serial ports have separate read and write pins, you can
simultaneously read and write data. This is illustrated below.
Writing Data
This section describes writing data to your serial port device in three parts:
“The Output Buffer and Data Flow” describes the flow of data from MATLAB
to the device.
“Writing Text Data” describes how to write text data (string commands) to
the device.
“Writing Binary Data” describes how to write binary (numerical) data to the
device.
The functions associated with writing data are given below.
Table 8-5: Functions Associated with Writing Data
Function Name Description
fprintf
Write text to the device
fwrite Write binary data to the device
stopasync Stop asynchronous read and write operations
Serial Port I/O Hardware
s=serial('COM1');
fopen(s)
COM1
InstrumentMATLAB
Write
Read
Write
Read