ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating waveform graph each second

Solved!
Go to solution

I am acquiring data using daqmx function in a while loop and I want to display the real time data on a waveform graph. I need the graph to update each second with the new data acquired and ignore the data of the last second/seconds. I created a simple program to show what I am doing, the problem with my current implementation is that the new data keeps getting appended to the array and the waveform graph ends up acting as a waveform chart and shows the whole array instead of the data of the last second. I would be grateful if someone instructs me to how to implement it right 🙂

0 Kudos
Message 1 of 3
(2,040 Views)
Solution
Accepted by Amr95

Hi Amr,

 


@Amr95 wrote:
I created a simple program to show what I am doing, the problem with my current implementation is that the new data keeps getting appended to the array and the waveform graph ends up acting as a waveform chart and shows the whole array instead of the data of the last second. I would be grateful if someone instructs me to how to implement it right 🙂
  • As your loop is set to iterate 1000 times per second you should update your graph only each 1000th iteration! Using Q&R on the loop iterator will easily determine that…
  • As your loop is collecting ALL samples in this array you should only take the last 1000 samples to show them on your graph - as you want to present the samples of the last 1 second! (Build arrays this way is considered highly inefficient…)
  • When using real DAQmx functions you could set a samplerate and read the same amount of samples to effectively get new data once per second…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(1,997 Views)

Can you demonstrate your solution GerdW, I would also like to see the solution for this problem. 

0 Kudos
Message 3 of 3
(1,615 Views)