Main Content

target.TargetConnection class

Package: target

Provide details about connecting MATLAB computer to target hardware

Description

Use the target.TargetConnection class, which inherits functionality from target.Connection, to provide details about connecting your MATLAB® computer to target hardware. For example, the communication channel and connection properties that are required for communication with your target hardware.

To create a target.TargetConnection object, use the target.create function.

Properties

expand all

Name of connection object.

Attributes:

GetAccess
public
SetAccess
public

Associate a target.CommunicationChannel object with your connection, which describes the type of channel that is used. For example, to specify serial or TCP channel properties, use target.RS232Channel or target.TCPChannel respectively.

Attributes:

GetAccess
public
SetAccess
public

Associate a target.Board object with your connection, which describes the target hardware that is connected to the MATLAB computer.

Attributes:

GetAccess
public
SetAccess
public

Associate a target.ConnectionProperties object with your connection that describes the MATLAB computer connection properties that are used to connect to the target hardware. For example, to specify the serial port, use a target.Port object.

Attributes:

GetAccess
public
SetAccess
public

Associate a target.ConnectionProperties object with your connection that describes the target hardware connection properties that are used to connect to the MATLAB computer. For example, to specify the serial port, use a target.Port object.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code from Set Up PIL Connectivity by Using target Package shows how to specify the connection between your development computer and target hardware. In the example, the target application runs on your development computer as a separate process and uses a TCP communication channel through localhost.

connection = target.create('TargetConnection');
connection.Name = 'Host Process Connection';
connection.Target = hostTarget;
connection.CommunicationChannel = target.create('TCPChannel');
connection.CommunicationChannel.Name = 'External Process TCPCommunicationChannel';
connection.CommunicationChannel.IPAddress = 'localhost';
connection.CommunicationChannel.Port = '0';
Introduced in R2020b