Main Content

getNodeAttributes

Read OPC UA server node attributes

Description

example

Values = getNodeAttributes(UaClient,NodeList,AttributeIds) reads from the server the attributes defined by AttributeIds for the nodes identified by NodeList. You can define node objects for NodeList using getNamespace or browseNamespace.

Values = getNodeAttributes(NodeList,AttributeIds) reads from the nodes identified by NodeList. All nodes must be of the same connected client.

Examples

collapse all

This example shows how to read node attributes from the server for one layer of the namespace.

s = opcuaserverinfo('localhost');
UaClient = opcua(s);
connect(UaClient);
NodeList = getNamespace(UaClient);
Values = getNodeAttributes(UaClient,NodeList,{'NodeId','Description'})
Values = 
4x1 struct array with fields:
    NodeId
    Description

Input Arguments

collapse all

OPC UA client, specified as an OPC UA client object

List of nodes, specified as an array of node objects. For information on node object functions and properties, type

help opc.ua.Node

Server attributes specified as an array of uint32, cell array of character vectors, or array of strings. For information on server AttributeId values, type

help opc.ua.AttributeId

Output Arguments

collapse all

Attribute values, returned as a structure. The structure array contains the fields given by the AttributeIds. If an attribute cannot be read for a node, the relevant field will be empty.

Version History

Introduced in R2015b