wait - Suspend MATLAB® execution until object stops logging

Syntax

wait(GObj)
wait(GObj, TSec)

Description

wait(GObj) suspends MATLAB execution until the group object GObj has stopped logging. GObj must be a scalar dagroup object.

wait(GObj, TSec) will wait at most TSec seconds for GObj to stop logging. If the group object is still logging when the timeout value is exceeded, an error message is generated.

The wait function can be useful when you want to guarantee that data is logged before another task is performed.

You can press Ctrl+C to interrupt the wait function. An error message will be generated, and control will return to the MATLAB command window.

Examples

This example logs 60 seconds of data from the Matrikon™ Simulation Server's Random.Real8 and Random.UInt4 tags, at 1-second intervals. A message indicating that acquisition is complete is displayed, and the data is retrieved and plotted.

da = opcda('localhost','Matrikon.OPC.Simulation');
connect(da)
grp = addgroup(da,'WaitExample');
itm = additem(grp, {'Random.Real8','Random.UInt4'});
set(grp, 'RecordsToAcquire',60, 'UpdateRate',1);
start(grp);
wait(grp)
disp('Acquisition complete');
[itmID,v,q,t]=getdata(grp, 'double');
plot(t(:,1),v(:,1), t(:,2), v(:,2));
legend(itmID);

See Also

start, stop, getdata

  


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