Main Content

readbinblock

Read one binblock of data from VISA resource

Since R2021a

    Description

    data = readbinblock(v) reads a binblock of data from the VISA resource v and returns the data as a row vector of doubles. The function suspends MATLAB® execution until the full binblock is read or a timeout occurs.

    The function discards and clears any data in the buffer before the recognized binblock. If no binblock is found the operation times out, returns an empty value, and discards all the data in the buffer. An error in the operation also flushes the data buffer.

    example

    data = readbinblock(v,datatype) reads a binblock of data interpreted as the type specified by datatype. For numeric types, the data is returned as a row vector of doubles. For text types, the data is returned as a character vector or string, as specified.

    Examples

    collapse all

    Create a connection to a VISA resource. This example shows a connection to a device with the alias COM4 using the VISA-Serial interface.

    v = visadev("COM4");

    Read a binblock of uint8 data from the VISA resource v.

    data = readbinblock(v);

    Input Arguments

    collapse all

    VISA resource, specified as a visadev object.

    Example: readbinblock(v) reads a binblock of data from the VISA resource v.

    Size and format of each value, specified as a character vector or string. datatype determines the number of bytes to read for each value and the interpretation of those bytes as a MATLAB data type.

    Example: readbinblock(v,"double") reads a binblock of double data.

    Data Types: char | string

    Version History

    Introduced in R2021a