set (serial)

Configure or display serial port object properties


props = set(obj)
props = set(obj,'PropertyName')


set(obj) displays all configurable properties values for the serial port object, obj. If a property has a finite list of possible string values, then these values are also displayed.

props = set(obj) returns all configurable properties and their possible values for obj to props. props is a structure whose field names are the property names of obj, and whose values are cell arrays of possible property values. If the property does not have a finite set of possible values, then the cell array is empty.

set(obj,'PropertyName') displays the valid values for PropertyName if it possesses a finite list of string values.

props = set(obj,'PropertyName') returns the valid values for PropertyName to props. If PropertyName does not have a finite list of possible values, props is a cell array of possible string values or an empty cell array.

set(obj,'PropertyName',PropertyValue,...) configures multiple property values with a single command.

set(obj,PN,PV) configures the properties specified in the cell array of strings PN to the corresponding values in the cell array PV. PN must be a vector. PV can be m-by-n where m is equal to the number of serial port objects in obj and n is equal to the length of PN.

set(obj,S) configures the named properties to the specified values for obj. S is a structure whose field names are serial port object properties, and whose field values are the values of the corresponding properties.


This example illustrates shows how to use the set function to configure or return property values, on a Windows® platform.

s = serial('COM1');
[ {none} | odd | even | mark | space ]

More About

expand all


Refer to Configuring Property Values for a list of serial port object properties that you can configure with set.

You can use any combination of property name/property value pairs, structures, and cell arrays in one call to the set function. Additionally, you can specify a property name without regard to case, and you can use property name completion. For example, if s is a serial port object, then the following commands are all valid.


See Also

Introduced before R2006a

Was this topic helpful?