LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple solution to initialize default values of all Chart/Graph inside while loop on rerun

Solved!
Go to solution

I am simply reading a csv data from file or getting similar line profile data from image. Then I am plotting its graph inside a while loop and also doing curve fitting ouside the loop.Praogram works fine but on running next time in some graph earlier data is retained. I wish that all the graphs/ charts etc inside this simple while loop should initialize when I run it next. In properity dropdown for these chart/graph clear option is there which I am using each time before rerun but how to activate that clear chart on running the program. I can see some lengthy solution using shift register which I wish to avoid. VI and data file is attched

Ajay Shankar
Download All
0 Kudos
Message 1 of 11
(3,312 Views)
Solution
Accepted by topic author AjayShankar

Graphs will clear each time you write to them.  Charts will keep the history.  To clear a chart, you have to write an empty array to it's History property.


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 2 of 11
(3,300 Views)

Go to "vi properties...execution" and check "clear indicators when called". That's all you need.

0 Kudos
Message 3 of 11
(3,297 Views)

Thanks and it worked for full VI. Means it will be good if entire VI indicators are initialized what if only a particular while loop or section of program is to be initialized

Ajay Shankar
0 Kudos
Message 4 of 11
(3,292 Views)
Solution
Accepted by topic author AjayShankar

@AjayShankar wrote... what if only a particular while loop or section of program is to be initialized

Use Tim's solution. Have you tried?

0 Kudos
Message 5 of 11
(3,290 Views)

OK, back on a computer and I can look at your code.

  1. In what way does your VI have anything to do with the problem you are describing?
  2. Why are you using an XY graph if the x-values are equally spaced? Why are you using the express VI at all? (There is absolutely no need for dynamic data and express VIs here!)

So please go back and make a simple demo VI that relates to the question in some way (e.g. actually contains a loop and such)

0 Kudos
Message 6 of 11
(3,286 Views)

But in while loop curves keep ob blinking . Trying to fix

Ajay Shankar
0 Kudos
Message 7 of 11
(3,272 Views)

See one portion of code while using Tom solution my graph is blinking. Actually I am using two sinusoidal signals generated from the line profile of an interference pattern as sine and cosine signal . I have to find its quadrature error therefore I will have to plot it individually as well as one against other to see circle fitting. Its only an initial part.  I wanted to solve it piece wise so took its line profile, saved it as csv data file and trying to fit curves. Attaching  VI to see where I am missing

Ajay Shankar
Download All
0 Kudos
Message 8 of 11
(3,268 Views)

Never attach a new VI with the same name of another VI you have attached earlier. Always give it a new name!

Why do you think you need to re-read the same fine 20x per second?

Why do you use a chart instead of a graph?

0 Kudos
Message 9 of 11
(3,265 Views)
Solution
Accepted by topic author AjayShankar

@AjayShankar wrote:

See one portion of code while using Tom solution my graph is blinking. Actually I am using two sinusoidal signals generated from the line profile of an interference pattern as sine and cosine signal . I have to find its quadrature error therefore I will have to plot it individually as well as one against other to see circle fitting. Its only an initial part.  I wanted to solve it piece wise so took its line profile, saved it as csv data file and trying to fit curves. Attaching  VI to see where I am missing


OK, this does not make a lot of sense and seems overly complicated.

 

  • Your attached file only contains a single column, so where is the quadrature data? Why do you carry everything as 2D arrays?
  • If you have quadrature data, represent it as a complex 1D array and you'll be almost there.
  • The use of charts is incorrect here. Use graphs.
  • Can't you use classic signal processing to get the desired information (FFT, cross-correlation, etc.). Fitting to a sinosoid is typically very dangerous unless you have good guesses, because the is an infinite number of alias frequencies that would fit equally well.

 

0 Kudos
Message 10 of 11
(3,260 Views)