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.
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','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');