Path: news.mathworks.com!not-for-mail
From: "Dave Hathaway" <david.hathaway@aecom.com>
Newsgroups: comp.soft-sys.matlab
Subject: DAQ SamplesAvailable never >0 after getdata
Date: Tue, 9 Feb 2010 15:56:02 +0000 (UTC)
Organization: AECOM
Lines: 22
Message-ID: <hks0ii$p3$1@fred.mathworks.com>
Reply-To: "Dave Hathaway" <david.hathaway@aecom.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1265730962 803 172.30.248.37 (9 Feb 2010 15:56:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Feb 2010 15:56:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1931390
Xref: news.mathworks.com comp.soft-sys.matlab:605786


I am prototyping a data acquisition system by using the 'winsound' device.  The actual device will operate at 200hz and I will need to collect the 200 samples each second, do some processing each minute, and more at each hour.  That's a little background.

Right now, I'm trying to collect data from the winsound device at 5000 samples per second.  I've borrowed code from the daqwaterfall example in the Complete Application Development class.  My thought is to collect the data each second, and I have the TimerFcn being called reliably.

In it, I am using the SamplesAvailable property to see when the data is ready.  I use getdata to extract the data...

% timer function
function localtimer_callback(obj,event)

if obj.SamplesAvailable > 0
    x = getdata(obj);
    % do stuff with x
end
...

The problem is that when I use getdata rather than peekdata, the SamplesAvailable is always at 0.  The TimerFcn keeps popping along, but there are never any SamplesAvailable.

I have tried this with the SamplesAcquiredFcn as well, with the same result.

What am I doing wrong?

Dave