MATLAB Function Reference |
Configure or display serial port object properties
Syntax
set(obj)
props = set(obj)
set(obj,'
PropertyName
')
props = set(obj,'
PropertyName
')
set(obj,'
PropertyName
',PropertyValue,...)
set(obj,PN,PV)
set(obj,S)
Arguments
obj |
A serial port object or an array of serial port objects. |
' PropertyName ' |
A property name for obj . |
PropertyValue |
A property value supported by PropertyName . |
PN |
A cell array of property names. |
PV |
A cell array of property values. |
S |
A structure with property names and property values. |
props |
A structure array whose field names are the property names for obj , or cell array of possible values. |
Description
displays all configurable properties values for set(obj)
obj
. If a property has a finite list of possible string values, then these values are also displayed.
returns all configurable properties and their possible values for props = set(obj)
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,'
displays the valid values for PropertyName
')
PropertyName
if it possesses a finite list of string values.
returns the valid values for props = set(obj,'
PropertyName
')
PropertyName
to props
. props
is a cell array of possible string values or an empty cell array if PropertyName
does not have a finite list of possible values.
configures multiple property values with a single command.set(obj,'
PropertyName
',PropertyValue,...)
configures the properties specified in the cell array of strings set(obj,PN,PV)
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
.
configures the named properties to the specified values for set(obj,S)
obj
. S
is a structure whose field names are serial port object properties, and whose field values are the values of the corresponding properties.
Remarks
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 set
. Additionally, you can specify a property name without regard to case, and you can make use of property name completion. For example, if s
is a serial port object, then the following commands are all valid.
set(s,'BaudRate') set(s,'baudrate') set(s,'BAUD')
If you use the help
command to display help for set
, then you need to supply the pathname shown below.
help serial/set
Examples
This example illustrates some of the ways you can use set
to configure or return property values for the serial port object s
.
s = serial('COM1');
set(s,'BaudRate',9600,'Parity','even')
set(s,{'StopBits','RecordName'},{2,'sydney.txt'})
set(s,'Parity')
[ {none} | odd | even | mark | space ]
Functions
setfield | setstr |