Main Content


Remove nodes from client subscription

Since R2023b



    removenode(SubscrObj,NodeList) removes the specified nodes from the subscription of the OPC UA client.


    collapse all

    Create a subscription for an OPC UA client with several nodes, then remove some nodes from the subscription.

    UaClient = opcua('localhost', 51210);
    FirstNodes = browseNamespace(UaClient);    % Manually select nodes for subscription.
    SubscrObj = subscribe(UaClient,FirstNodes,@mycallback,PublishInterval=3);
    NodesToRemove = browseNamespace(UaClient); % Manually select nodes for removal.

    Other possible forms of removenode might look like these:

    removenode(SubscrObj, ["Sawtooth","Square"]); % Array of node names
    removenode(SubscrObj, NodeList);   % Array of Node objects
    removenode(SubscrObj, [2 3 4 7]);  % Array of node index IDs
    removeNode(SubscrObj, "2:10225");  % Namespace:Identifier

    The namespace index and identifier are available in the Node properties.

    Input Arguments

    collapse all

    Subscription, specified as an object. You create this object with the subscribe function.

    List of nodes to remove from client subscription, specified as an array of node objects, names, index IDs, or namespace identifiers. For information on node object functions and properties, type


    Example: NodeList = browseNamespace(UaClient)

    Data Types: integer | char | string | object

    Version History

    Introduced in R2023b

    See Also