Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getNameSpace (opchda)

Package: opc.hda

OPC historical data access server name space

Syntax

NS = getNameSpace(HdaObj)
NS = getNameSpace(HdaObj,'StartItemID','itemID')
NS = getNameSpace(HdaObj, 'Depth', dLevel)
NS = getNameSpace(HdaObj,'StartItemID','itemID','Depth',dLevel)

Description

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 level(s) 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

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)

Get only the first level of the name space:

nsPart = getNameSpace(hdaObj,'Depth',1)

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);

See Also

Introduced in R2011a

Was this topic helpful?