This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Stop asynchronous read and write operations




stopasync(obj) stops any asynchronous read or write operation that is in progress for the serial port object, obj.


You can write data asynchronously using the fprintf or fwrite function. You can read data asynchronously using the readasync function, or by configuring the ReadAsyncMode property to continuous. In-progress asynchronous operations are indicated by the TransferStatus property.

If obj is an array of serial port 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.

  • 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.

Introduced before R2006a