Main Content

getNamespace

Namespace of OPC UA server associated with client

Description

nodes = getNamespace(uaClient) retrieves one layer of the namespace of the server associated with client object uaClient. The namespace is stored in the Namespace property of uaClient as a hierarchical tree of nodes.

nodes = getNamespace(uaClient,browseNode) retrieves only the nodes referenced from browseNode, and stores them in the Children property of browseNode. If the browseNode argument is empty or omitted, the first layer of the namespace is retrieved and stored in the client.

getNamespace might not need to retrieve nodes from the server. If the nodes already exist locally, they are returned automatically.

nodes = getNamespace(___,'-force') forces retrieval of the Children property contents from the server again and stores them in browseNode, even if the nodes already exist locally.

Note

When retrieving a namespace with many children, you should allow a significant amount of time for this function to complete, especially when displaying the results in the MATLAB® command window. For example, retrieving a namespace with several thousand children could take up to a minute or more.

example

Examples

collapse all

This example shows how to retrieve one layer of the namespace from the OPC UA client.

s = opcuaserverinfo("localhost");
uaClient = opcua(s);
connect(uaClient);
nodes = getNamespace(uaClient)
nodes = 
1x4 OPC UA Node array:
    index      Name       NsInd  Identifier  NodeType  Children
    -----  -------------  -----  ----------  --------  --------
      1    Server         0      2253        Object    10
      2    Data           2      10157       Object    3
      3    Boilers        4      1240        Object    2
      4    MemoryBuffers  7      1025        Object    2

Input Arguments

collapse all

OPC UA client, specified as an OPC UA client object

Browse node, specified as a node object.

Output Arguments

collapse all

Layer of namespace tree from server, returned as a structure.

Version History

Introduced in R2015b