Contenu principal

readValue

R2026b

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 node objects.

[values,timestamps,qualities] = readValue(nodeList) reads from the nodes identified by nodeList. All nodes must be associated to 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. You can create node objects using findNodeByName, findNodeById, browseNamespace, or getNamespace. For more information, see opcuanode.

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. The OPC UA server always returns the datetime values in the time zone of the MATLAB® client used to retrieve the data.

Node data quality, returned as an array of OPC UA qualities.

Version History

Introduced in R2015b

expand all