User`s manual
8 Serial Port I/O
8-24
Creating a Serial Port Object
You create a serial port object with the serial function. serial requires the
name of the serial port connected to your device as an input argument.
Additionally, you can configure property values during object creation. For
example, to create a serial port object associated with the serial port COM1
s = serial('COM1');
The serial port object s now exists in the MATLAB workspace. You can display
the class of
s with the whos command.
whos s
Name Size Bytes Class
s 1x1 512 serial object
Grand total is 11 elements using 512 bytes
Once the serial port object is created, the properties listed below are
automatically assigned values. These general purpose properties provide
descriptive information about the serial port object based on the object type and
the serial port.
You can display the values of these properties for
s with the get function.
get(s,{'Name','Port','Type'})
ans =
'Serial-COM1' 'COM1' 'serial'
Table 8-3: Descriptive General Purpose Properties
Property Name Description
Name
Specify a descriptive name for the serial port object
Port
Indicate the platform-specific serial port name
Type
Indicate the object type