User`s manual
Writing and Reading Data
8-41
Asynchronous operations do not block access to the MATLAB command line. 
Additionally, while an asynchronous read operation is in progress, you can:
•Execute an asynchronous write operation since serial ports have separate 
pins for reading and writing
•Make use of all supported callback properties
You can determine which asynchronous operations are in progress with the 
TransferStatus property. If no asynchronous operations are in progress, then 
TransferStatus is idle.
s.TransferStatus
ans =
idle
Rules for Completing a Read Operation with fscanf.
A read operation with fscanf 
blocks access to the MATLAB command line until:
•The terminator specified by the 
Terminator property is read.
•The time specified by the 
Timeout property passes.
•The specified number of values specified is read.
•The input buffer is filled.
Reading Binary Data
You use the fread function to read binary data from the device. Reading binary 
data means that you return numerical values to MATLAB.
For example, suppose you want to return the cursor and display settings for the 
oscilloscope. This requires writing the 
CURSOR? and DISPLAY? commands to the 
instrument, and then reading back the results of those commands.
s = serial('COM1');
fopen(s)
fprintf(s,'CURSOR?')
fprintf(s,'DISPLAY?')
Since the default value for the ReadAsyncMode property is continuous, data is 
asynchronously returned to the input buffer as soon as it is available from the 
device. You can verify the number of values read with the 
BytesAvailable 
property.










