Main Content

readValue

Read values from nodes on OPC UA server

Description

[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.

example

Examples

collapse all

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

uaClient = opcua('localhost',53530); 
connect(uaClient); 
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, see OPC UA Node.

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, see OPC UA Server Data Types.

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, see OPC UA Quality.

Version History

Introduced in R2015b