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. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

opcua (opcua)

Construct OPC UA client object


UaClient = opcua(ServerInfoObj)
UaClient = opcua(ServerUrl)
UaClient = opcua(Hostname,Portnum)


UaClient = opcua(ServerInfoObj) constructs an OPC UA client associated with the server referenced by ServerInfoObj. You can create server objects with the opcuaserverinfo function.

UaClient = opcua(ServerUrl) constructs a client associated with the server referenced by the URL provided in ServerUrl. The server URL must use the opc.tcp protocol; OPC Toolbox™ does not support http or https connections.

UaClient = opcua(Hostname,Portnum) constructs an OPC UA client object associated with the server at port Portnum on the machine identified by Hostname. Hostname can be an IP address, or host name (short or fully qualified) specified as a character vector or string. The client attempts to retrieve available endpoints, but does not error if the endpoints cannot be retrieved.


Some OPC UA servers require security for any connection to that server. OPC Toolbox supports only anonymous, unsecured connections to servers.


Create a client for the first server found on the local host.

S = opcuaserverinfo('localhost');
UaClient = opcua(S(1));

Create a client for the server at port 51210 on the local host.

UaClient = opcua('localhost',51210)
UaClient = 
OPC UA Client UA Sample Server:
    Hostname: localhost
        Port: 51210
     Timeout: 10

      Status: Disconnected

See Also



Introduced in R2015b

Was this topic helpful?