wait

Suspend MATLAB execution until object stops logging

Description

example

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

Use the wait function when you want to guarantee that all data is logged before another task is performed.

You can press Ctrl+C to interrupt the wait function. An error message appears, and control returns to the MATLAB command window.

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

Examples

collapse all

Log 60 seconds of data and plot the results.

Log 60 seconds of data at 1-second intervals from the Matrikon™ simulation server tags Random.Real8 and Random.UInt4. When logging is complete, display a message, then retrieve and plot the data.

da = opcda('localhost','Matrikon.OPC.Simulation');
connect(da)
grp = addgroup(da,'WaitExample');
itm = additem(grp,{'Random.Real8','Random.UInt4'});
grp.RecordsToAcquire = 60;
grp.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);

Input Arguments

collapse all

OPC DA group, specified as a DA group object.

Example: addgroup()

Maximum wait time, specified as seconds in any numeric type.

Example: 60

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

See Also

Functions

Introduced before R2006a