Hello everybody,
I'm trying to acquire and store data from a CompactDAQ from National Instruments. The configuration of the device itselt and the visualization of the data is pretty straightforward, but I'm having trouble in store this data in a matrix that I will be able to access after the acquisition is over.
I'm connecting the device as follows:
s=daq.createSession('ni');s.addAnalogInputChannel('cDAQ1Mod2', 0, 'voltage');s.Rate=2000;s.DurationInSeconds = 60;
to plot the data in real time I use the following lines of code:
lh = s.addlistener('DataAvailable', @plotData); function plotData(src,event) plot(event.TimeStamps, event.Data)end
and then I start it in background (I need to acquire data in background in order to perform other tasks at the same time):
s.startBackground();
This seems to work fine for the real time problem, but I'm having trouble to define a callback function that will store all data acquired into a matrix or structure. I'm sure that this is a quite basic problem.
I want to thank you all in advance for your time.
Best Answer