Main Content


(To be removed) Remove data from input buffer

This serial, Bluetooth, tcpip, udp, visa, and gpib object function will be removed in a future release. Use serialport, bluetooth, tcpclient, tcpserver, udpport, and visadev object functions instead. For more information, see Compatibility Considerations.





An interface object or an array of interface objects.


flushinput(obj) removes data from the input buffer associated with obj.


After the input buffer is flushed, the BytesAvailable property is automatically configured to 0.

If flushinput is called during an asynchronous (nonblocking) read operation, the data currently stored in the input buffer is flushed and the read operation continues. You can read data asynchronously from the instrument using the readasync function.

The input buffer is automatically flushed when you connect an object to the instrument with the fopen function.

You can clear the output buffer with the flushoutput function. You can clear the hardware buffer for GPIB and VXI instruments with the clrdevice function.

Compatibility Considerations

expand all

Not recommended starting in R2019b

Not recommended starting in R2020b

Not recommended starting in R2020b

Not recommended starting in R2020b

Not recommended starting in R2021a

Not recommended starting in R2021b

See Also



Introduced before R2006a