Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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

Log 60 seconds of data at 1-second intervals from the Matrikon™ Simulation Server's Random.Real8 and Random.UInt4 tags. Display a message indicating that the acquisition is complete, 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);

See Also

| |

Introduced before R2006a

Was this topic helpful?