Instrument Control Toolbox | ![]() ![]() |
Read binblock data from the instrument
Syntax
A = binblockread(obj)
A = binblockread(obj,'precision
')
[A,count] = binblockread(...)
[A,count,msg] = binblockread(...)
Arguments
Description
A = binblockread(obj)
reads binary-block (binblock) data from the instrument connected to obj
and returns the values to A
. The binblock format is described in the binblockwrite
reference pages.
A = binblockread(obj,'
reads binblock data translating MATLAB values to the precision specified by precision
')
precision
. By default the uchar
precision is used and numeric values are returned in double-precision arrays. Refer to the fread
function for a list of supported precisions.
[A,count] = binblockread(...)
returns the number of values read to count
.
[A,count,msg] = binblockread(...)
returns a warning message to msg
if the read operation did not complete successfully.
Remarks
Before you can read data from the instrument, it must be connected to obj
with the fopen
function. A connected instrument object has a Status
property value of open
. An error is returned if you attempt to perform a read operation while obj
is not connected to the instrument.
binblockread
blocks the MATLAB command line until one of the following occurs:
Timeout
property passes.
If msg
is not included as an output argument and the read operation was not successful, then a warning message is returned to the command line.
The ValuesReceived
property value is increased by the number of values read, each time binblockread
is issued.
Example
Create the GPIB object g
associated with a National Instruments GPIB controller with board index 0, and a Tektronix TDS 210 oscilloscope with primary address 2.
Connect g
to the instrument, and write string commands that configure the scope to transfer binary waveform data from memory location A.
fopen(g) fprintf(g,'DATA:DESTINATION REFA'); fprintf(g,'DATA:ENCDG SRPbinary'); fprintf(g,'DATA:WIDTH 1'); fprintf(g,'DATA:START 1');
Write the CURVE?
command, which prepares the scope to transfer data, and read the data using the binblock format.
Functions
binblockwrite
, fopen
, fread
, instrhelp
Properties
BytesAvailable
, InputBufferSize
, Status
, ValuesReceived
![]() | Functions - Alphabetical List | binblockwrite | ![]() |