0

I have a loop of reading Voltages from Arduino (with a specific sampling rate and clock Frequency).

When I read data without plotting (loop include only the fread/fscanf and i++), the data appears without any problems.

Once I add rolling plot to display the acquired data, the signal will be lost at a sudden and the program stops. Any clarification for that?

If there exist a sample code for multi-threading to plot and perform data acquisition in the same time, I would be very grateful.

Thank you!

  • 1
    Can you show us your code? This looks like it should work – Ander Biguri Mar 30 '15 at 08:06
  • It's probably `fread` from a serial connection? Then there is some bug in your code, serial connections don't simply get "lost", only issue I could imagine that Matlab does not return a required ack within some timeout. Please show us the code which produces the problem. – Daniel Apr 02 '15 at 19:20

1 Answers1

0

I am not sure whether it works for you, but I had the same problem and I used pause(t) before the end of the loop.

Yacine
  • 321
  • 2
  • 15
  • We are making ECG acquisition on real time, if we pause to give hand to Matlab for plotting, we'll certainly lose the aspect of real time monitoring (ECG: we cannot pause heart electrical activity ;) ) – Zebbiche Badreddine Mar 30 '15 at 10:13