write - Write values to group or items

Syntax

write(GObj,Values)
write(IObj,Values)

Description

write(GObj,Values) writes values to all the items contained in the dagroup object GObj. Values is a cell array of values--one for each item. To ensure that a specific value is written to the correct item object, you should construct the Values cell array based on the order of the items returned by the Item property.

write(IObj,Values) writes values to all the items contained in the vector of daitem objects specified by IObj.

The data types of the values do not need to match the canonical data type of the associated items. However an error is returned if a data type conversion cannot be performed.

Because the values are written to the device, this operation might be slow. The function does not return until it verifies that the device has actually accepted or rejected the data.

Examples

Configure a client, group, and items for the Matrikon™ Simulation Server.

da = opcda('localhost', 'Matrikon.OPC.Simulation');
connect(da);
grp = addgroup(da, 'ExWrite');
itm = additem(grp, {'Bucket Brigade.Real8', ...
    'Bucket Brigade.String'});

Read and write values to/from the items.

write(grp, {23, 'Hello World!'})
r = read(grp)
write(itm(1), 15)
r2 = read(itm(1))

See Also

read, readasync, refresh, writeasync

  


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