Main Content

getNameSpace

OPC HDA server name space

Description

example

NS = getNameSpace(HdaObj) retrieves the entire server name space from the connected OPC HDA Client HdaObj.

NS = getNameSpace(HdaObj,'StartItemID','itemID') retrieves the server name space beginning at Fully Qualified Item ID 'itemID', and all branches in the name space below 'itemID'.

NS = getNameSpace(HdaObj,'Depth',dLevel) retrieves the dLevel levels of the server name space beginning at the server name space root. Specifying dLevel as 1 retrieves only the nodes (branch and leaf) contained in the root of the server name space.

NS = getNameSpace(HdaObj,'StartItemID','itemID','Depth',dLevel) retrieves the dLevel levels of the name space starting at Fully Qualified Item ID 'itemID'.

In all cases, NS is a recursive structure array representing the name space of the server. Each element of NS is a node in the name space. NS contains the fields:

  • Name — a descriptive name

  • FullyQualifiedID — the fully qualified ItemID of that node

  • NodeType — defines the node as a 'branch' node (containing other nodes) or 'leaf' node (containing no other nodes)

  • Nodes — a structure array with the same fields as NS, representing the nodes contained in this branch of the name space

Use flatnamespace to flatten the hierarchical name space.

Examples

collapse all

  1. Get the entire name space for the Matrikon™ Simulation Server on the local host:

    hdaObj = opchda('localhost','Matrikon.OPC.Simulation');
    connect(hdaObj); 
    nsFull = getNameSpace(hdaObj)
  2. Get only the first level of the name space:

    nsPart = getNameSpace(hdaObj,'Depth',1)
  3. Add the nodes contained in the first branch of the name space to the existing structure:

    nsPart(1).Nodes = getNameSpace(hdaObj, ... 
        'StartItemID',nsPart(1).FullyQualifiedID, ... 
        'Depth',1);

Version History

Introduced in R2011a

See Also

Functions