Main Content

opchda

Create OPC historical data access client

Description

hdaObj = opchda(SIObj) constructs an OPC HDA client object, hdaObj, for the information provided in the OPC HDA ServerInfo object, SIObj, obtained from an opchdaserverinfo function call.

example

hdaObj = opchda(Hostname,ServerID) constructs hdaObj for the host specified by Hostname and the OPC server ID specified by ServerID.

When you construct hdaObj, its initial Status property value is 'disconnected'. To communicate with the server, connect hdaObj to the server using the connect function.

example

hdaObj = opchda(Hostname,ServerID,Name,Value) applies the specified property values to the client created with the Host and ServerID parameters. If you specify an invalid property name or value, the function does not create an object.

hdaObj = opchda(SIObj,Name,Value) applies the specified property values to the client created with the ServerInfo object, SIObj. If you specify an invalid property name or value, the function does not create an object.

Examples

collapse all

Create an OPC HDA client object for a specific client on the local host.

hdaObj = opchda('localhost','MyHDAServer.1');

Create OPC HDA client objects for all clients on the local host.

SIObj  = opchdaserverinfo('localhost');
hdaObj = opchda(SIObj);

Input Arguments

collapse all

OPC HDA server information, specified as an OPC HDA ServerInfo object. This object is returned from the function opchdaserverinfo.

Example: SIOjb = opchdaserverinfo

OPC HDA server host name specified as a character vector or string.

Example: 'host-name'

Data Types: char | string

Identifier of OPC HDA server, specified as a character vector or string.

Example: 'MyHDAServer.1'

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Timeout',60

The argument name identifies a property of the created OPC HDA client object. Note that the name-value pairs can be any format that the set function supports, i.e., name-value pairs, structures, and name-value cell array pairs.

Maximum time to wait for completion of instruction to server, specified in seconds.

Example: 60

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Data to associate with object, specified as any MATLAB data type. UserData stores any data that you want to associate with the object. The object does not use this data directly, but you can use the data for identification or other purposes.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char | struct | string | cell

Output Arguments

collapse all

OPC HDA client, returned as an OPC HDA client object.

Version History

Introduced in R2013a

See Also

Functions