External Interfaces/API |
Example: Reading Binary Data
This example illustrates how you can download the TDS 210 oscilloscope screen display to MATLAB. The screen display data is transferred and saved to disk using the Windows bitmap format. This data provides a permanent record of your work, and is an easy way to document important signal and scope parameters.
Because the amount of data transferred is expected to be fairly large, it is asynchronously returned to the input buffer as soon as it is available from the instrument. This allows you to perform other tasks as the transfer progresses. Additionally, the scope is configured to its highest baud rate of 19,200.
s
associated with serial port COM1.
s
to the oscilloscope. Because 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 instrument.
s
, you should disconnect it from the instrument, and remove it from memory and from the MATLAB workspace.
Viewing the Bitmap Data
To view the bitmap data, you should follow these steps:
imread
function.
imagesc
function.
Note that the file I/O versions of the fopen
, fwrite
, and fclose
functions are used.
fid = fopen('test1.bmp','w'); fwrite(fid,out,'uint8'); fclose(fid) a = imread('test1.bmp','bmp'); imagesc(a)
Because the scope returns the screen display data using only two colors, an appropriate colormap is selected.
The resulting bitmap image is shown below.
Example: Parsing Input Data Using strread | Events and Callbacks |