This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create an OPC HDA Client Object

After determining the host name and server ID of the OPC server you want to connect to, you can create an OPC HDA client object. The client controls the connection status to the server, stores properties of that server, and allows you to read data from the server.

Create an OPC HDA client using the opchda function, specifying the host name and server ID arguments:

>> hdaClient = opchda('localhost', 'Matrikon.OPC.Simulation.1')

hdaClient =
OPC HDA Client localhost/Matrikon.OPC.Simulation.1:
	Host: localhost
	ServerID: Matrikon.OPC.Simulation.1
	Timeout: 10 seconds

	Status: disconnected

	Aggregates: -- (client is disconnected)
	ItemAttributes: -- (client is disconnected)

You can also construct client objects directly from an OPC HDA ServerInfo object:

>> hostInfo = opchdaserverinfo('localhost');
>> hdaClient = opchda(hostInfo(1));