error dialog when timeout occurs

1 view (last 30 days)
u
u on 1 Sep 2014
hi
In my GUI application, its a single channel acquisition from serial port of a instrument using NI daq card in this way..
fopen(s); %%% open the serial port oject
start(ai); %%analog input object. wait(ai,10); %%%wait for 10 second for data to acquire..
data=getdata(ai,2000); %%no. of samples to acquire 2000 stop(ai);
fclose(s); %%%close the serial port object s delete (s); clear (ai) delete(ai)
I want to create a error dialog when timeout occurs i.e. signal doesn't come within the wait time(10 seconds). and it sould close the serial port and clear the ai object for the next acquisition.
how can I do this.. please help me.
Thank You.
  2 Comments
Adam
Adam on 1 Sep 2014
Edited: Adam on 1 Sep 2014
doc timer
doc errordlg
looks as though it would help do the job.
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 1 Sep 2014
Adam you should have posted this as an answer.

Sign in to comment.

Answers (0)

Categories

Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!