Main Content


(To be removed) Stop asynchronous read and write operations

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 on updating your code, see Compatibility Considerations.





An interface object or an array of interface objects.


stopasync(obj) stops any asynchronous read or write operation that is in progress for obj.


You can write data asynchronously using the fprintf or fwrite functions. You can read data asynchronously using the readasync function, or by configuring the ReadAsyncMode property to continuous (serial port, TCPIP, UDP, and VISA-serial objects). In-progress asynchronous operations are indicated by the TransferStatus property.

If obj is an array of interface objects and one of the objects cannot be stopped, the remaining objects in the array are stopped and a warning is returned. After an object stops,

  • Its TransferStatus property is configured to idle.

  • Its ReadAsyncMode property is configured to manual (serial port, TCPIP, UDP, and VISA-serial objects).

  • The data in its output buffer is flushed.

Data in the input buffer is not flushed. You can return this data to the MATLAB® workspace using any of the synchronous read functions. If you execute the readasync function, or configure the ReadAsyncMode property to continuous, then the new data is appended to the existing data in the input buffer.

Version History

Introduced before R2006a

expand all

R2021b: gpib object interface will be removed

Use of this function with a gpib object will be removed. To access a GPIB instrument, use the VISA-GPIB interface with a visadev object, its functions, and its properties instead.

The recommended functionality has additional capabilities and improved performance. See Transition Your Code to VISA-GPIB Interface for more information about using the recommended functionality.

See Also