Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
peekdata - really latest samples? - buffer?

Subject: peekdata - really latest samples? - buffer?

From: Eric Nobel

Date: 20 Jul, 2011 13:17:09

Message: 1 of 3

I'm using an mcc FS1608 AD-Converter to sample analog data input with the DataAcquisitionToolbox and Matlab2011. (Windows XP).

The sample rate is set to 1000
Channels: 6

In a while loop I used peekdata(AI,1) to look at the latest samples acquired. This while loop acquires nearly 2000 peeks per second (which is for sure influenced by the CPU speed).
If I add each of these samples to a vector an plot this, one can clearly see, that the data is "grouped": The values are equal for around 110-130 samples (60-70ms), followed by another 110-130 samples (60-70ms) block of (other) equal values and so on.

The engine seems to transfer the data in blocks. As long as the latest block is not filled up yet (which takes around 60-70ms), peekdata takes the latest sample from the second last block.

Is my theory correct?
Can I minimize the size of this block in order to peek at the truly latest samples?

Thank you very much for your help!


Subject: peekdata - really latest samples? - buffer?

From: Mazhar

Date: 27 Jul, 2012 18:15:07

Message: 2 of 3

Hello Eric,

I am facing the same problem. Have you got the solution yet?


Subject: peekdata - really latest samples? - buffer?

From: Mazhar

Date: 30 Jul, 2012 18:48:13

Message: 3 of 3

Eric and others who are facing same problem,

I tried to use peekdata. But I could not solve it by that. I then read the demos of continuous Data acquisition from matlab help. I think for these kinds of works getdata is useful.

you can use like this:

while ( isrunning(ai) )
            while(ai.SamplesAvailable <= 0)
           [data,time, abstime] = getdata(ai,ai.SamplesAvailable);

     %% do here whatever you want to do with data



Tags for this Thread

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.

Contact us