Main Content

peekdata

(To be removed) Preview most recently acquired data

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

Syntax

S = peekdata(GObj,NRec)

Description

S = peekdata(GObj,NRec) returns the NRec most recently acquired records for the dagroup object, GObj, without removing those records from the toolbox engine. GObj must be a scalar dagroup object. S is a structure array containing data for each record, in the same format as the structure returned by getdata.

If NRec is greater than the number of records currently available, a warning will be generated and all available records will be returned.

You use peekdata when you want to return logged data but you do not want to remove the data from the buffer. The object's RecordsAvailable property value will not be affected by the number of samples returned by peekdata.

peekdata is a non-blocking function that immediately returns records and execution control to the MATLAB® workspace.

Examples

Configure and start a logging task for 60 seconds of data.

da = opcda('localhost','Matrikon.OPC.Simulation');
connect(da);
grp = addgroup(da,'ExOPCREAD');
itm1 = additem(grp,'Triangle Waves.Real8');
itm2 = additem(grp,'Saw-Toothed Waves.Int2');
grp.LoggingMode = 'memory';
grp.RecordsToAcquire = 60;
start(grp);

Wait for 2 seconds and peek at the two most recent records.

pause(2);
s = peekdata(grp,2)
s.Items(1).Value

Version History

Introduced before R2006a

expand all

See Also

Functions