I have been looking around various forums and sites in order to find an answer to this question, but am yet to find anything which helps me with my problem, so hoping someone has some ideas here :)
I am writing an application which retrieves data from an NI USB-6009 device and displays it in a graph, in real-time. This I can achieve easily by creating a listener that plots the data in the specified graph, the problem is to retrieve that data after the aquisition has completed and then perform various tasks on this.
Here is a small part of my code that might explain my situation further;
handles.data = zeros(ai.Channels.Count,ai.NumberOfScans);
lh = ai.addlistener('DataAvailable',@(src,event)plotData(handles,src,event));
Using this setup I call the function plotData and am able to use the handles to find the appropriate graph to plot the data in.
In the function plotData I wish to save the data so that I can somehow use this later, I tried to initialise a handles.data object to save the data in. The problem is that it seems the updating of handles.data in the function is not seen in the main function.
Here is the function plotData:
data = event.Data;
handles.data(1,(event.TimeStamps*src.Rate)+1) = data(:,1)';
This does not change the value of the handles.data object, have also tried using the set-function without success.
Any ideas on how I am to save this data so that I can access it after the aquisition has been completed?
P.S The indexes on the data object is merely to do with using multiple channels during retrieving... D.S