Documentation Center

  • Trial Software
  • Product Updates


Connecting to the Device

Before you can use the serial port object to write or read data, you must connect it to your device via the serial port specified in the serial function. You connect a serial port object to the device with the fopen function.


Some properties are read only while the serial port object is connected and must be configured before using fopen. Examples include the InputBufferSize and the OutputBufferSize properties. To determine when you can configure a property, see Property Reference.

    Note    You can create any number of serial port objects, but you can connect only one serial port object per MATLAB® session to a given serial port at a time. However, the serial port is not locked by the session, so other applications or other instances of MATLAB software can access the same serial port, which could result in a conflict, with unpredictable results.

You can examine the Status property to verify that the serial port object is connected to the device.

ans =

As shown in the following illustration, the connection between the serial port object and the device is complete; data is readable and writable.

Was this topic helpful?