LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to force refresh of plot

Solved!
Go to solution

I am trying to load data from a text file and plot it on 2 different contour (3d surface plots).  Inevitably, the first time I load the file after I open the VI, the coarse plot does not update.  However the fine plot does.  I don't know if this is an issue of timing the completion of loading all the data from the file, or what.  I have tried re-wiring error wires to force sequence and I have tried sequential structures.  Nothing seems to work and I can't find a control to allow me to force it to refresh.  Does anyone know what might be going on here?  I have included the 2 required VI's and a sample text file.  Can anyone help me out here?

Thanks,

Chris

 

0 Kudos
Message 1 of 4
(3,375 Views)
Solution
Accepted by topic author chrisjfrye

Hi Chris,

 

I ran your code with the highlight execution tool (lightbulb next to the pause button in the run menu - sorry if I just insulted your intelligence, just not sure of your experience with LabVIEW). I noticed the local variables just outside of the sequence structure would update first with values of 0.0 then the code would perform the file dialog function along with the code proceding that function. Since the local variables were called first in LabVIEW and updated with zeros as opposed to data that was acquired from your text file, the result is a blank course plot.

 

When you run the code a second time, the local variables have since been updated with the correct values which is why you get the plot.

 

I have attached a screenshot and a .vi of my suggestions for what you can do to ensure those local variables update at the appropriate time and allow for the data to be plotted to the course interpolation on the first run. I hope this has resolved your issue. If not, please let me know.

 

Also, I will take much heat from other programmers out there if I did not at least mention that using multiple local variables across your .vi can be problematic in the sense that it can be difficult to manage dataflow properly and can lead to troubleshooting frustrations. There are certainly better alternatives, but I figured you would rather have a quick solution for now and worry about cleaning up the code later.

 

Hope this helps,

Cory

Message 2 of 4
(3,352 Views)
Just wire directly without any local variables or sequence structure.
0 Kudos
Message 3 of 4
(3,343 Views)
Thanks, Cory. Don't worry about insulting my intelligence.
I understand what you are saying and it makes sense after you explained it. I have not been programming LabVIEW very long and have no formal training. I was trying to keep the code LOOKING neater by using the local variables, but ended up causing problems with the execution a's a result. Sometimes it seems like the wires can get pretty messy sometimes. Thanks for helping me and teaching me a more important lesson, in general, for LabVIEW programming!
Chris
0 Kudos
Message 4 of 4
(3,317 Views)