genslread

Generate Simulink OPC Read block from MATLAB group object

Syntax

BlkPath = genslread(GrpObj)
BlkPath = genslread(GrpObj, DestSys)

Description

BlkPath = genslread(GrpObj) generates an OPC Read block from the dagroup object GrpObj, and places the block in a new Simulink® model. The OPC Read block has the same name, update rate, and items as GrpObj. If all items in GrpObj have the same data type, the OPC Read block's Value port indicates that data type. BlkPath indicates the full path to the new OPC Read block.

BlkPath = genslread(GrpObj, DestSys) generates the OPC Read block and places it into the system defined by DestSys. DestSys must be a model name or a path to a subsystem block. The OPC Read block automatically takes a location that attempts to minimize overlap of lines and blocks, however, the block might appear over an existing annotation.

Examples

Create a group object with two items, and then construct an OPC Read block from the group:

da = opcda('localhost', 'Matrikon.OPC.Simulation');
grp = addgroup(da, 'ExOPCREAD');
itm1 = additem(grp, 'Triangle Waves.Real8');
itm2 = additem(grp, 'Saw-Toothed Waves.Int2');
% Set update rate to 2 seconds:
grp.UpdateRate = 2;
% Construct OPC Read block:
blkPath = genslread(grp)

See Also

Was this topic helpful?