Main Content

findNodeByName

Find OPC UA server nodes by name

    Description

    foundNodes = findNodeByName(nodeList,nodeName) searches the descendants of nodeList for all nodes whose Name property matches nodeName. The search among all nodes, including nodeList, is not case sensitive.

    foundNodes = findNodeByName(nodeList,nodeName,searchPreference) finds nodes based on specified searchPreferencce.

    This function might query the server for further descendants (children) of nodeList.

    example

    Examples

    collapse all

    Create an OPC UA client object and connect to an OPC UA server on the localhost. Find the ServerCapabilities node in the server namespace using the node name.

    uaClient = opcua("localhost",51210);
    connect(uaClient);
    serverNode = findNodeByName(uaClient.Namespace,"Server","-once");
    capabilitiesNode = findNodeByName(serverNode,"ServerCapabilities")
    capabilitiesNode = 
    OPC UA Node:
    
       Node Information:
                          Name: 'ServerCapabilities'
                   Description: 'Describes capabilities supported by the server.'
                NamespaceIndex: 0
                    Identifier: 2268
                      NodeType: 'Object'
    
       Hierarchy Information:
                        Parent: Server
                      Children: 14

    Input Arguments

    collapse all

    List of nodes, specified as an array of node objects. For information on node object functions and properties, see OPC UA Node.

    Name of the node to be found, specified as string or character vector.

    Search preference, specified as one of these:

    • '-once': Stop searching when one matching node is found

    • '-partial': Find all nodes that start with NodeName

    • '-once','-partial': Stop searching when the first partial matching node is found

    Output Arguments

    collapse all

    List of matching nodes, returned as an array of node objects.

    Version History

    Introduced in R2015b

    expand all

    See Also

    Functions