Make copy of OPC data access object
NewObj = copyobj(Obj)
NewObj = copyobj(Obj, ParentObj)
NewObj = copyobj(Obj) makes a copy of all
the objects in
Obj, and returns them in
Obj can be a scalar OPC object, or a
vector of toolbox objects.
NewObj = copyobj(Obj, ParentObj) makes a
copy of the objects in
Obj inside the parent object
ParentObj must be a valid
scalar parent object for
Obj. If any objects in
Obj cannot be created in
warning will be generated.
A copied toolbox object contains new versions of all children, their children, and any parents that are required to construct that object. A copied object is different from its parent object in the following ways:
The values of read-only properties will not be copied to the new object. For example, if an object is saved with a Status property value of
'connected', the object will be recreated with a
Statusproperty value of
'disconnected'(the default value). You can use
propinfoto determine if a property is read-only. Specifically, a connected
opcdaobject is copied in the disconnected state, and a copy of a logging
dagroupobject is not reset to the logging state.
dagroupobject that has records in memory from a logging session is copied without those records.
OPC HDA objects do not support
Create a connected Data Access client with a group containing an item:
da1 = opcda('localhost', 'Matrikon.OPC.Simulation'); connect(da1); grp1 = addgroup(da1, 'CopyobjEx'); itm1 = additem(grp1, 'Random.Real8');
Copy the client object. This also copies the group and item objects.
da2 = copyobj(da1); grp2 = da2.Group
Change the first group name, and note that the second group name is unchanged:
grp1.Name = 'NewGroupName'; grp2.Name
Introduced before R2006a