Main Content

getAllChildren

Recursively retrieve all children of OPC UA server node

Description

childNodes = getAllChildren(startNode) returns all children of a given node as a vector of Node objects, including all children recursively.

Note

This function is memory intensive. Use it only when necessary. Alternatively, consider accessing the Children property of the node, or searching with browseNamespace, findNodeByName, or findNodeById.

example

Examples

collapse all

Create an OPC UA client object and connect to an OPC UA server on the localhost.

uaClient = opcua("localhost",51210);
connect(uaClient);

Specify a node from the server namespace.

serverNode = uaClient.Namespace(1);

Retrieve children nodes of the specified node

allServerNodes = getAllChildren(serverNode);
whos allServerNodes
  Name                Size             Bytes  Class          Attributes

  allServerNodes      1x349             2896  opc.ua.Node  

Input Arguments

collapse all

OPC UA node, specified as an OPC UA node object.

Output Arguments

collapse all

All children of the specified node, returned as an array of node objects.

Version History

Introduced in R2015b