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.


Add data access group to opcda object


GrpObj = addgroup(DAObj)
GrpObj = addgroup(DAObj,'GName')
GrpObj = addgroup(DAObj,'GName','GrpType')


GrpObj = addgroup(DAObj) adds a group to the opcda object DAObj. A group is a container for a client to organize and manipulate data items. Typically, you create different groups to support different update rates, activation status, callbacks, etc.

GrpObj is a dagroup object. By default, GrpObj has the Active property set to 'on', GroupType set to 'private', and the Subscription property set to 'on'.

If DAObj is already connected to the server when addgroup is called, a group name is requested from the server. If the server does not supply a group name, or the object is not connected to a server, a unique name is automatically assigned to GrpObj. The unique name follows the convention 'groupN' where N is an integer. You can change this name with the group's Name property.

GrpObj = addgroup(DAObj,'GName') adds a group to the OPC data access object DAObj with the group name given by 'GName'. The group name must be unique among other group names within Obj.

GrpObj = addgroup(DAObj,'GName','GrpType') adds a group to the opcda object DAObj with the group type specified by 'GrpType'. If 'GrpType' is 'private' (the default) the group is configured to be private to DAObj, and no other client connected to the OPC server can access that group. If 'GrpType' is 'public' then a connection is made to the server's public group named GName. To make a connection to a public group named GName, that group must exist on the server as a public group. You create public groups on the server using the makepublic function. Note that some servers do not support public groups; you can verify whether a server supports public groups by running opcserverinfo(DAObj) and checking the SupportedInterfaces field for the IOPCServerPublicGroups interface.

You can add items to GrpObj using the additem function, if the group type is 'private'. For a public group, the items are already defined, and are automatically created when you connect to the public group using addgroup.


Create an opcda client:

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

Create a group using a default group name:

grp1 = addgroup(da);

Add another group, providing the name:

grp2 = addgroup(da, 'AddgroupEx');

Introduced before R2006a

Was this topic helpful?