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

2 views (last 30 days)
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; = 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 object to save the data in. The problem is that it seems the updating of 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,'YData',data(:,1));,(event.TimeStamps*src.Rate)+1) = data(:,1)';
% set(,(event.TimeStamps*src.Rate)+1),data(:,1)')
This does not change the value of the 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

Sign in to comment.

Answers (0)


Find more on Simultaneous and Synchronized Operations 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!

Translated by