LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Graph does not retain the data at end of while loop

Solved!
Go to solution

I have a weird problem. In the first diagram snippet I am plotting data on an XY Graph. When I press stop the while loop the XY Graph clears even though probes and a second XY Graph (created for debugging purposes) show that there is still data - the arrays are not empty. I created a simple test VI to investigate the behaviour and the diagram is shown on the second snippet. In the test VI the data is retained and displayed on the graph when the loop stops. This is the behaviour I was expecting. What am I doing wrong in the first one?

Download All
0 Kudos
Message 1 of 10
(642 Views)

It's hard to say, can you upload the code so we can see everything?

 

That local variable after probe 7 seems unnecessary, but I don't think it would cause the behavior seeing.

0 Kudos
Message 2 of 10
(636 Views)

Here's the VI. The local variable is just there for debug purposes. When you open it there will be a missing VI, Get_AIN_Data_JEJ. This just grabs single data points from a data acquisition device. You can replace it with a random number generator to get the VI to run.

0 Kudos
Message 3 of 10
(630 Views)
Can you click "file >> save for previous version..." and select 2016? Please attach that version of the file.
0 Kudos
Message 4 of 10
(624 Views)

It threw a whole bunch of warnings at me, so hopefully you will be able to open it.

0 Kudos
Message 5 of 10
(608 Views)

When you click STOP the inside timed while loop will stop running. The outside while loop will continue running, which clears the graph data every iteration in the top left corner. Then when you press EXIT the outside loop will stop running.

 

Remove that local variable in the top left, or drag it outside the while loop, if you don't want to clear the data.

0 Kudos
Message 6 of 10
(600 Views)
Solution
Accepted by topic author JohannJunginger

In the top left corner of the outer While loop, you are clearing the graph.  When you press "Stop", that will stop the inner loop.  That will then iterate the outer loop, which contains clearing of the graph.  All you need to do is delete that code to clear the graph.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 10
(599 Views)

Maybe you should not clear in in the upper left corner of your code:

 

altenbach_0-1722448879588.png

 

0 Kudos
Message 8 of 10
(598 Views)

Ha!  3 answers that are all the same within a minute of each other.  At least I know I'm not crazy about this fix.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 10
(591 Views)

It was an easy fix. I can't believe I didn't figure this out right away.

0 Kudos
Message 10 of 10
(586 Views)