LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I plot a single point on a graph and increase by each point from a while loop?

I have a data acquisition system that is recording temperature and pressure readings inside a while loop. Each time I flip a switch it takes a single set of data. For simplicity, let's say I want to flip this switch 5 times to record 5 different sets of temp/pressure readings.

 

Numerous calculations are being done on the values output from the data acquisition for each iteration (each time I flip the switch). Eventually I output an X and a Y value that I would like to graph in real-time.

 

I want to do the following:

 

1) For each iteration, I want to see how (X,Y) is changing (it should be dancing around in about the same location on the plot) before I flip the switch to record that data point.

 

2) After I flip the switch to move to the second iteration, I want it to save the previous iteration's point and display it on the graph and draw a line from that point to the new point...which again should be changing.

 

3) The third iteration should show one point changing, while the other two points are stationary. These three points should form a curve.

 

So after I flip the switch 5 times I will have 5 stationary data points on my graph forming a curve.

 

I've been trying numerous things with for loops and case structures, but I can't seem to figure out the basic structure I need to make this happen. Any help will be greatly appreciated!

0 Kudos
Message 1 of 6
(3,226 Views)

If you've got your program set up in a while loop, add a shift register to loop. This creates a memory space that will store all your values. Every time you flip a switch, insert the new data point into the array of data coming from your shift register. This new array gets sent to the shift register on the right side of your loop. An XY Graph can be updated with the new array of data every time you record a data point.

 

Eric

0 Kudos
Message 2 of 6
(3,220 Views)

I am having a similar problem and am confused as to what exactly I connect my shift registers too? I have never used one before.

0 Kudos
Message 3 of 6
(2,762 Views)

There are a lot of options for connecting your shift registers, in this case you will simply want to pass the array of data into your while loop. The array should pass through a case structure where if the button is not pressed it just passes through, but if it is pressed then it will add a new item to the array.

 

Without a VI or at least a picture to help describe what you are doing it is quite difficult to help out. If a picture is worth a thousand words then a VI must be worth a million.

Message 4 of 6
(2,756 Views)

@ogk.nz wrote:

There are a lot of options for connecting your shift registers, in this case you will simply want to pass the array of data into your while loop. The array should pass through a case structure where if the button is not pressed it just passes through, but if it is pressed then it will add a new item to the array.

 

Without a VI or at least a picture to help describe what you are doing it is quite difficult to help out. If a picture is worth a thousand words then a VI must be worth a million.


Hah, that's what I say, too - except that I say a picture is worth a thousand words and a VI is worth a thousand pictures - which is the same thing.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 6
(2,750 Views)

Moved here:  http://forums.ni.com/t5/LabVIEW/stationary-graph/m-p/3050885

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 6 of 6
(2,739 Views)