Clear serial port device buffers
Flush Serial Port Device Inputs and Outputs
Create a connection to a serial port device.
device = serialport("COM3",9600)
device = Serialport with properties: Port: "COM3" BaudRate: 9600 NumBytesAvailable: 0 Show all properties, functions
Write some data to the device and view the number of bytes available to be read in the input buffer.
ans = 5
Flush both the input and output buffers.
View the number of bytes available to be read.
ans = 0
The input buffer has no data.
Introduced in R2019b