External Interfaces/API    

Configuring and Returning Properties

You establish the desired serial port object behavior by configuring property values. You can display or configure property values using the set function, the get function, or dot notation.

Displaying Property Names and Property Values

Once the serial port object is created, you can use the set function to display all the configurable properties to the command line. Additionally, if a property has a finite set of string values, then set also displays these values.

You can use the get function to display one or more properties and their current values to the command line. To display all properties and their current values

To display the current value for one property, you supply the property name to get.

To display the current values for multiple properties, you must include the property names as elements of a cell array.

You can also use the dot notation to display a single property value.

Configuring Property Values

You can configure property values using the set function

or the dot notation.

To configure values for multiple properties, you can supply multiple property name/property value pairs to set.

Note that you can configure only one property value at a time using the dot notation.

In practice, you can configure many of the properties at any time while the serial port object exists - including during object creation. However, some properties are not configurable while the object is connected to the device or when recording information to disk. Refer to Property Reference for information about when a property is configurable.

Specifying Property Names

Serial port property names are presented using mixed case. While this makes property names easier to read, you can use any case you want when specifying property names. Additionally, you need use only enough letters to identify the property name uniquely, so you can abbreviate most property names. For example, you can configure the BaudRate property any of these ways.

When you include property names in an M-file, you should use the full property name. This practice can prevent problems with future releases of MATLAB if a shortened name is no longer unique because of the addition of new properties.

Default Property Values

Whenever you do not explicitly define a value for a property, then the default value is used. All configurable properties have default values.

If a property has a finite set of string values, then the default value is enclosed by {}. For example, the default value for the Parity property is none.

You can find the default value for any property in the property reference pages.

  The Serial Port Session Creating a Serial Port Object