Thread Subject: delay getdata, start(analoginput)

Subject: delay getdata, start(analoginput)

From: Jonas

Date: 28 Sep, 2009 15:27:02

Message: 1 of 2

Hi, I'm using the data acquisition toolbox to continuously sample from an analog input channel of a National Instruments card. However, there seems to be a varying delay of at least 40 ms between signal change and matlab response. This is due to the functions "start(ai)" and "getdata(ai)". Is there a way to speed up the acquisition, maybe by changing the analog input object configuration? My current configuration is as follows:
 
SampleRate: 10000
SamplesPerTrigger: 2

I'm looping through following code:

                start(ai)
                pause(0.001);
                data = mean(getdata(ai));
                stop(ai)

Thx for any response.

Jonas

Subject: delay getdata, start(analoginput)

From: Sherryl Radbil

Date: 29 Sep, 2009 12:43:04

Message: 2 of 2

Hi Jonas,
Rather than stopping and restarting the analog input object, which will introduce the delay you are seeing, use callbacks which you can begin learning about here:
http://www.mathworks.com/access/helpdesk/help/toolbox/daq/f9-34753.html

Pay particular attention to the Timer and SamplesAcquired events.

All the best,
Sherryl

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com