On Fri, 8 Jul 2005 04:56:52 -0400, Cristian M�ller wrote:
> how can i start a timer from the daq Toolbox.Theoretically its very
> ai1 = analoginput('winsound',0);
> addchannel(ai1, 1:2);
> ai1.SampleRate = 11025;
> function TimerFcn_Callback
> But the function doesn't start loopig!
There are two problems with your code. The first is that your timer
period is set to 3 seconds, but you are only acquiring 1 second of data.
The TimerFcn only executes while the analog input object is "running".
Since the object only runs for one second your timer function will never
get called. You need to either decrease your timer period or increase
the time that your object is running.
The second problem is that your TimerFcn_Callback function has the wrong
syntax. When you specify the TimerFcn property as a function handle
(@TimerFcn_Callback), then the function is passed in two arguments. The
first is the object that generated the callback and the second is an
event structure that describes what caused the callback to happen. You
can ignore these if you like, but you need to change the line
to something like
function TimerFcn_Callback(obj, event)
Hope this helps.