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
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
>> hostInfo = opchdaserverinfo('localhost'); >> hdaClient = opchda(hostInfo(1));