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 (opcda)

OPC data access server name space


S = getnamespace(DAObj)
S = getnamespace(DAObj,'Filter1',Val1,'Filter2',Val2, ...)


S = getnamespace(DAObj) returns the entire name space of the server associated with the data access (opcda) object specified by DAObj. S is a recursive structure array representing the name space of the server. Each element of S is a node in the name space. S 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 S, representing the nodes contained in this branch of the name space.

Use flatnamespace to flatten the hierarchical name space.

S = getnamespace(DAObj,'Filter1',Val1,'Filter2',Val2, ...) allows you to filter the retrieved name space based on a number of available browse filters. Available filters are described in the following table:




Specify the FullyQualifiedID of a branch node, as a character vector or string. Only nodes contained in that branch node will be returned. Some OPC servers do not support partial name space retrieval based on this option: An error is generated if you attempt to use the 'StartItemID' browse filter on such a server.


Specify the depth of the name space that you want returned. A 'Depth' value of 1 returns only the nodes contained in the starting position. A 'Depth' value of 2 returns the nodes contained in the starting position and all of their nodes. A 'Depth' value of Inf returns all nodes. When combined with the 'StartItemID' filter, the 'Depth' filter provides a useful way to investigate a name server hierarchy one layer at a time.


Restricts the search to leaf nodes with particular access right characteristics. Specify 'read' to return nodes that include the read access right, and 'write' to return nodes that include the write access right. An empty character vector ('') returns nodes with any access rights. Note that branch nodes will still be returned in the name space, in order to contain the leaf nodes that have the requested access rights.


Restricts the search to nodes with a particular canonical data type. Valid data types are 'double', 'single', 'int8', 'int16', 'int32', 'uint8', 'uint16', 'uint32', 'logical', 'currency', and 'date'. Use the 'DataType' filter to find server items with a specific data type, such as 'double' or 'date'. Note that branch nodes will still be returned in the name space, in order to contain the leaf nodes that have the required data type.


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

da = opcda('localhost','Matrikon.OPC.Simulation');
nsFull = getnamespace(da)

Get only the first level of the name space:

nsPart = getnamespace(da,'Depth',1)

Add the nodes contained in the first branch of the name space to the existing structure:

nsPart(1).Nodes = getnamespace(da, ...
   'StartItemID', nsPart(1).FullyQualifiedID, ...

Introduced before R2006a

Was this topic helpful?