Data Aquisition Toolbox, Session-Based Interfaces - Saving processed data during startBackground for later use

2 次查看(过去 30 天)
Hello!
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));
ai.startBackground();
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:
function plotData(handles,src,event)
data = event.Data;
set(handles.p_t0,'XData',event.TimeStamps);
set(handles.p_t0,'YData',data(:,1));
handles.data(1,(event.TimeStamps*src.Rate)+1) = data(:,1)';
% set(handles.data(1,(event.TimeStamps*src.Rate)+1),data(:,1)')
end
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?
Cheers! /Nichlas
P.S The indexes on the data object is merely to do with using multiple channels during retrieving... D.S
  2 个评论
Jim
Jim 2013-4-11
Just plugged in a new NI DAQ in 64-bit session mode, and rapidly came to the same point as this poster - works great plotting, but how to retrieve data from startBackground? No answer or comment posted for a long time? Is this possible?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by