Main Content

flush

Clear buffers for communication with VISA resource

Since R2021a

    Description

    flush(v) flushes all data from both the input and output buffers of the VISA resource v and clears the hardware output buffer of the instrument.

    example

    flush(v,"input") flushes only the input buffer of the VISA resource.

    flush(v,"output") flushes only the output buffer of the VISA resource.

    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");

    Write some data to the device and view the number of bytes available to be read in the input buffer.

    write(v,1:5,"uint8")
    v.NumBytesAvailable
    ans =
    
         5

    Flush both the input and output buffers.

    flush(v)

    View the number of bytes available to be read.

    v.NumBytesAvailable
    ans =
    
         0

    The input buffer has no data.

    Input Arguments

    collapse all

    VISA resource, specified as a visadev object.

    Example: flush(v) flushes data from the VISA resource v.

    Version History

    Introduced in R2021a

    See Also

    | |