Main Content


Read values from nodes on OPC UA server



[Values,Timestamps,Qualities] = readValue(UaClient,NodeList) reads the value, quality, and timestamp from the nodes identified by NodeList, on the server associated with the connected client UaClient. NodeList can be a single OPC UA node object or an array of nodes.

[Values,Timestamps,Qualities] = readValue(NodeList) reads from the nodes identified by NodeList. All nodes must be of the same connected client.


collapse all

Read the current value from a node identified by its Index and Identifier.

UaClient = opcua('localhost',53530); 
sineNode = opcuanode(3,'Sinusoid',UaClient); 
[val,ts,qual] = readValue(UaClient,sineNode)

Read from multiple nodes.

simNode = findNodeByName(UaClient.Namespace,'Simulation');
simChildNodes = simNode.Children;
[val,ts,qual] = readValue(UaClient,simChildNodes)

Input Arguments

collapse all

OPC UA client, specified as an OPC UA client object. The client must be connected.

List of nodes, specified as an array of node objects or a single node. You can create node objects using getNamespace, browseNamespace, or opcuanode. For information on node object functions and properties, type:


You can read only from variable type nodes, not object type nodes. If you specify an object node to read, the return value is an empty array, and the quality is set to Bad:AttributeIdInvalid.

Output Arguments

collapse all

Node values, returned as node data type, or a cell array of node data types if NodeList is an array.. For information about how MATLAB interprets these formats, type:


Time of node data source, returned as a vector of MATLAB datetime objects. Timestamps represent the time that the source provided the data to the server.

Node data quality, returned as an array of OPC UA qualities. For information on OPC UA qualities, type:


Version History

Introduced in R2015b