Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Ideas on how to speed up plotting during realtime data acquisition?
Replies: 9   Last Post: Mar 5, 2013 8:51 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nathan

Posts: 9
Registered: 9/3/10
Ideas on how to speed up plotting during realtime data acquisition?
Posted: Sep 14, 2010 9:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

I am working on a GUI that displays in realtime data acquired from a high-speed digitizer card. I'm finding that in some cases that my code cannot keep up with the data acquisition and that some data is lost. I'm wondering if anyone might have some ideas on how I might be able to speed up the display side of things.

The digitizer card receives data every 100-200ms depending on the experiment. My software grabs a waveform, adds it to a variable for saving to file later, and displays it in a plot. Sometimes it takes too long to plot the waveform, and it misses the next acquisition. I think the plotting is the part that is causing me problems, but of course speeding up the rest would be helpful also.

Here is some pseudocode for the acquisition part:

Nwaveforms=500;
Npoints=1e5;

%Initialize data with zeros:
clear data
for a=1:Nwaveforms;
data(a).wf=zeros(1,Npoints); %wf to be saved to file later
data(a).st=''; %structure obtained from digitizer card with settings
end


%Set up plot
figure(1);clf
h=plot(nan,nan,'k-');

timevector=1:Npoints;

%obtain data
for a=1:Nwaveforms;
%acquire data from digitizer
[dummydata, dummystruct, dummyerror]=Get12bitDataFromDigitizerMEX(digitizerHandle, Nwaveforms);

%set data for saving later
data(a).wf=dummydata;
data(a).st=dummystruct;

%update plot
set(h,'xdata',timevector,'ydata',data(a).wf);
drawnow;
end

The above is written just to give an idea what the code is doing. I'm actually acquiring two or four 100000 point waveforms per acquisition (I'm going to increase to 8) and have up to 3 plots to update (which I'd like to increase also if feasible). There is also some simple analysis being done on the data that is displayed on the plot, and it checks for errors and whether the user hits a "stop" button.

Does anyone have any thoughts on how I might be able to display the data more efficiently?

Or maybe there is some way to make the display part a low priority that would be skipped/aborted if it takes more than some amount of time? Or some way to use more than one processor?

Any ideas would be appreciated.

Thanks,
N




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.