Main Content


(To be removed) Start a logging task

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




start(GObj) starts a data logging task for GObj. GObj can be a scalar dagroup object, or a vector of dagroup objects. A dagroup object must be active and contain at least one item for start to succeed.

When logging is started, GObj performs the following operations:

  1. Generates a Start event, and executes the StartFcn callback.

  2. If Subscription is 'off', sets Subscription to 'on' and issues a warning.

  3. Removes all records associated with the object from the toolbox engine.

  4. Sets RecordsAcquired and RecordsAvailable to 0.

  5. Sets the Logging property to 'on'.

The Start event is logged to the EventLog.

GObj will stop logging when a stop command is issued, or when RecordsAcquired reaches RecordsToAcquire.


Configure and start a logging task for 30 seconds of data:

da = opcda('localhost','Matrikon.OPC.Simulation');
grp = addgroup(da,'StartEx');
itm1 = additem(grp,'Triangle Waves.Real8');
itm2 = additem(grp,'Saw-toothed Waves.UInt16');
grp.LoggingMode = 'memory';
grp.UpdateRate = 0.5;
grp.RecordsToAcquire = 60;

Wait for the logging task to finish, then retrieve the records into a double array and plot the data with a legend:

[itmID, val, qual, tStamp] = getdata(grp, 'double');
plot(tStamp(:,1), val(:,1), tStamp(:,2), val(:,2));
datetick x keeplimits

Version History

Introduced before R2006a

expand all