Main Content

getNamespace

Namespace of OPC UA server associated with client

Description

example

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.

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