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.

readValue (opcua)

Read values from nodes on OPC UA server


[Values,Timestamps,Qualities] = readValue(UaClient,NodeList)
[Values,Timestamps,Qualities] = readValue(NodeList)



[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

This example shows how to read the value from a node identified by its Index and Identifier.

s = opcuaserverinfo('localhost');
UaClient = opcua(s(1));
node = opcuanode(2,10226,UaClient);
[val,tstamp,qual] = readValue(UaClient,node)
val =

tstamp = 
   05-Jun-2015 15:16:15

qual = 
OPC UA Quality ID:

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 values. 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:


Introduced in R2015b

Was this topic helpful?