Psychtoolbox interfering with MATLAB Data Acquisition Toolbox
13 views (last 30 days)
Show older comments
Hello,
I am writing software in MATLAB that collects certain data from an external device, while using Psychtoolbox for timing. However, when I add a listener to that device, using the MATLAB Data Acquisition Toolbox, and use the WaitSecs function of Psychtoolbox, the listener does not function properly. When I run the same code with MATLAB's built-in (yet much less accurate) pause() function, everything works properly.
For example, in this code, when the pause() function is replaced with WaitSecs, the data is no longer collected from the device:
s = daq.createSession('ni');
ai=s.addAnalogInputChannel('Dev1','ai0','Voltage');
ai.TerminalConfig='SingleEnded';
s.Rate = (1000);
s.DurationInSeconds = 5;
s.IsNotifyWhenDataAvailableExceedsAuto = true;
lh = s.addlistener('DataAvailable', @(src, event)function(src, event));
s.IsContinuous = true;
s.startBackground;
pause(1);
s.stop;
delete(lh);
If anyone has worked with Psychtoolbox in combination with the Data Acquisition Toolbox before, could you please suggest some tips?
Thank you!
0 Comments
Answers (0)
See Also
Categories
Find more on Image display and manipulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!