Main Content

getNamespace

OPC HDA server namespace

Description

serverNamespace = getNamespace(hdaObj) retrieves the entire server namespace from the connected OPC HDA Client hdaObj.

example

serverNamespace = getNamespace(hdaObj,Name=Value) retrieves a part of the server namespace based on the options specified in the name-value arguments.

example

Examples

collapse all

Get the entire namespace for the Matrikon™ Simulation Server on the local host

hdaObj = opchda('localhost','Matrikon.OPC.Simulation');
connect(hdaObj); 
nsFull = getNamespace(hdaObj)
nsFull = 

  5×1 struct array with fields:

    Name
    FullyQualifiedID
    NodeType
    Nodes

Get only the first level of the namespace.

nsPart = getNamespace(hdaObj,Depth=1);

Add the nodes contained in the first branch of the namespace to the existing structure.

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

  5×1 struct array with fields:

    Name
    FullyQualifiedID
    NodeType
    Nodes

Input Arguments

collapse all

OPC HDA client, specified as an OPC HDA client object.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: nsPart = getNamespace(hdaObj, StartItemID="Simulation Items", Depth=2);

Fully qualified item ID, specified as a character vector or string. The function retrieves the server namespace beginning at the specified fully qualified item ID, and all branches in the namespace below it.

Example: nsPart = getNamespace(hdaObj, StartItemID="Config Items");

Data Types: char | string

Number of levels of server namespace to retrieve beginning with the server namespace root, specified as a positive integer. Specifying Depth as 1 retrieves only the nodes (branch and leaf) contained in the root of the server namespace.

Example: nsPart = getNamespace(hdaObj, Depth=1);

Data Types: double

Output Arguments

collapse all

Server namespace, returned as a recursive array of structures. Each structure in the array represents a node and contains these fields:

  • Name— Descriptive name for the node.

  • FullyQualifiedID— Fully qualified ItemID of the node.

  • NodeType— Type of node returned as 'branch' node (when the node contains other nodes) or 'leaf' node (when the node does not contain other nodes)

  • Nodes— Array of structures representing the nodes contained in this branch of the namespace. The structures in this array have the same fields as the serverNamespace.

Version History

Introduced in R2011a

See Also

Functions