| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → OPC Toolbox |
| Contents | Index |
| Learn more about OPC Toolbox |
wait(GObj)
wait(GObj, TSec)
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.
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'});
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);
![]() | trend | write | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |