External Interfaces/API |
Writing and Reading Data
For many serial port applications, there are three important questions that you should consider when writing or reading data:
For write operations, these questions are answered in Writing Data. For read operations, these questions are answered in Reading Data.
Example: Introduction to Writing and Reading Data
Suppose you want to return identification information for a Tektronix TDS 210 two-channel oscilloscope connected to the serial port COM1. This requires writing the *IDN?
command to the instrument using the fprintf
function, and then reading back the result of that command using the fscanf
function.
The resulting identification information is shown below.
Configuring Communication Settings | Controlling Access to the MATLAB Command Line |