08-03-2017 08:10 AM - edited 08-03-2017 08:12 AM
I am a beginner in LabVIEW programming and in one of my VI's I need to plot measurement values in real time while keeping all values since the beginning, something like an infinite buffer. I have done that by appending each new measurement to an array and using a waveform graph, but I can't help but think that this is a highly inefficient method, so I would like to know if there is a better way to do that. I didn't have much success in my research so any help is welcome.
Thanks in advance.
Solved! Go to Solution.
08-03-2017 09:29 AM
Be careful how you use the term "Real-Time", as it has a precise meaning that is (I think) different from what you want.
You talk about an "infinite buffer". How big is "infinite"? Bigger than the memory on your PC (say, 16GB)? Bigger than a large disk on your PC (> 1TB)?
How much data is coming in, and how fast? [This has a bearing on "infinite", since it takes an infinite time to collect data being acquired at a finite rate].
What do you really need? Do you need access to all of the data while you are acquiring it? Do you need to view all of the data "all the time", or is it enough to see, say, the last 1000 points as they arrive, making sure that all of the data are being saved so you can go back and look at everything?
Assuming you can look at the last 1000 points and want to "save everything" to enable you, after the fact, to see the first 15 minutes of a 2-week recording session, I'd suggest the following:
Bob Schor
08-03-2017 09:36 AM
You can just use a waveform chart. This type of display keeps a history of its data. Delete all the array stuff and just wire your data (single point of data) into the chart indicator.
Other things:
1) Set the chart history length (right click option) to a number higher than you want to keep.
2) Turn on the X scrollbar in visible items, to scroll back
3) Clear the chart using a property node at the start of your program.
See attached where I have done all this, with chart length 10^6
If you need to do other things with the data, then the answer could be different.
08-03-2017 09:50 AM
08-03-2017 10:03 AM
thank you IanSh,
I used your solution with some little modification: now the x-axis is auto-scaled. that's what I wanted to get from the beginning.
10-13-2022 09:54 AM
Hey Bob, How to configure the Chart so it shows the last 1000 points you give it then overwrite on the previous data?
10-13-2022 01:13 PM
Hi Shinawee,
@SHINAWEE wrote:
How to configure the Chart so it shows the last 1000 points you give it then overwrite on the previous data?
Set its history length to 1000 samples…