output data to hardware length shorter than event data length
2 views (last 30 days)
Show older comments
Hi all,
I am using the session based interface of the data acquisition toolbox in 64 bit matlab on windows and I am confused by the length difference of the session object properties after triggering an DataAvailable event. I have queued an output data of X points in length, I am collecting data in the background, and have set NotifyWhenDataAvailableExceeds to trigger after all the data has been collected. When the listener is triggered the event.Data is the expected length (X points) however, the ScansOutputByHardware property is shorter by 100-200 points. Does this mean that all of the output data was not sent through the analog output? If so, how can I fix this?
I think this is a synchronization issue but I don't know how to synchronize the input and output channels using the session based interface.
Also, the IsDone property indicates that the data is still being collected, despite that the data collection should be over. Some code illustrating the issue is below. I would appreciate any insight. Thanks!
s = daq.createSession('ni');
s.Rate= 10000;
s.addAnalogOutputChannel('Dev1','ao0','Voltage');
s.addAnalogInputChannel( 'Dev1','ai0','voltage');
outputData = ones(s.Rate,1) ;
s.queueOutputData(outputData) ;
s.NotifyWhenDataAvailableExceeds = s.Rate ;
lh1 = s.addlistener('DataAvailable', @Checker);
s.startBackground() ;
function Checker(s,event)
dataL = length(event.Data),
dataHwOut = s.ScansOutputByHardware,
dataQ = s.ScansQueued,
dataSL = s.ScansAcquired,
end
0 Comments
Answers (0)
See Also
Categories
Find more on Data Acquisition Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!