Products & Services Solutions Academia Support User Community Company

Learn more about OPC Toolbox   

copyobj - Make copy of OPC Toolbox object

Syntax

NewObj = copyobj(Obj)
NewObj = copyobj(Obj, ParentObj)

Description

NewObj = copyobj(Obj) makes a copy of all the objects in Obj, and returns them in NewObj. Obj can be a scalar OPC Toolbox object, or a vector of toolbox objects.

NewObj = copyobj(Obj, ParentObj) makes a copy of the objects in Obj inside the parent object ParentObj. ParentObj must be a valid scalar parent object for Obj. If any objects in Obj cannot be created in ParentObj, a 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:

Examples

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 = get(da2, 'Group')

Change the first group's name, and note that the second group's name is unchanged:

set(grp1, 'Name', 'NewGroupName');
get(grp2, 'Name')

See Also

obj2mfile | propinfo

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS