Main Content

additem

(To be removed) Add data access items to dagroup object

Support for the OPC Data Access (DA) standard will be removed in a future release. Instead use OPC Unified Architecture (UA). See Compatibility Considerations.

Description

example

IObj = additem(GObj,'IName') adds items to the group object GObj with fully qualified item IDs given by IName. The object IObj is the created item object or objects, with properties described in daitem Properties. You specify IName as a single item ID or as a cell array of item IDs.

The daitem object provides a connection to a data variable in the physical device and returns information about the data variable, such as its value, quality, and time stamp. Note that you cannot add a given item to the same group more than once. However, you can add the same item to different groups.

By default, IObj is active; that is, if the group’s Subscription property is on, the item's Value, Quality, and TimeStamp properties will be updated at the group's UpdateRate.

Servers often require item IDs to be specified in the correct case. You can use the serveritems function to find valid item IDs.

Note

You cannot add items to a public group. A public group has a fixed set of item IDs common to all clients sharing that group. The GroupType property of a dagroup object indicates the type of group.

IObj = additem(GObj,'IName','DataType') adds items to the group object GObj with the requested data type given by 'DataType'. You specify 'DataType' as a cell array of character vectors, one for each item ID. 'DataType' is the data type in which the item's value is stored in the MATLAB® workspace. The supported data types are 'logical', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'single', 'double', 'char', and 'date'. Note that if the requested data type is rejected by the server, the item is not added. The requested data type is stored in the DataType property. The canonical data type (the data type used by the server to store the item value) is stored in the CanonicalDataType property.

IObj = additem (GObj,'IName','DataType','Active') adds items to the group object GObj with active status given by 'Active'. You specify 'Active' as a cell array of character vectors, one for each item ID. 'Active' can be 'on' or 'off'. The active status is stored in the Active property.

Examples

collapse all

Add items with different attributes to a group.

Create a client and a group.

da = opcda('localhost','Matrikon.OPC.Simulation');
connect(da);
grp = addgroup(da,'ExAddItem');

Add two items with their canonical data types.

itm = additem(grp, {'Random.Real4','Random.Real8'});

Add an item with a 'double' data type.

itmDbl = additem(grp,'Random.Int2','double');

Add an inactive item.

itmInact = additem(grp,'Random.UInt4','double','off');

Version History

Introduced before R2006a

expand all

See Also

Functions

Properties