Main Content


(To be removed) Remove data from output 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.


flushoutput(obj) removes data from the output buffer associated with obj.


After the output buffer is flushed, the BytesToOutput property is automatically configured to 0.

If flushoutput is called during an asynchronous (nonblocking) write operation, the data currently stored in the output buffer is flushed and the write operation is aborted. Additionally, the callback function specified for the OutputEmptyFcn property is executed. You can write data asynchronously to the instrument using the fprintf or fwrite functions.

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

You can clear the input buffer with the flushinput 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

Introduced before R2006a