LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update a Chart in a Loop with an Array, not a Single Value

Solved!
Go to solution

Hey everyone,

 

I'm new to the forums, but I've been doing LabVIEW for almost a year now.  I'm working on making my code much more streamlined, but I've run into a problem I can't seem to overcome. 

 

Say I want to graph a numeric control.  I update the numeric control to be 5 and the chart updates to 5.  Every time my loop executes, the 5 is replotted.  Easy to see that with fast loop updates, my FP will take way too much processing time.  How do I pass the control to an array and only plot the array every, say, 10 While Loop iterations?  I was thinking of using the "i" in the While Loop and a case structure (use Is Equal To? 10 as the True Case to update).  This doesn't really seem to be the answer... Any help is appreciated.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 1 of 7
(2,755 Views)
Solution
Accepted by topic author Nathan_S

Hi Mr. Bass,

 

Thank you for your post and welcome to the NI forums.

 

If you want to update every 10 iterations, for example, you can use LabVIEW's "Quotient and Remainder" function found in the Numeric palette - divide the iteration number by 10 and check the remainder, if it is equal to zero then you are on the 10th,20th,30th, etc. iteration. You can then use a case structure and write to your chart in the true case, with the condition being true if remainder is equal to zero.

 

Let me know how you get on with this method.

 

Thank you,

Eden S
Applications Engineer
National Instruments UK & Ireland
Message 2 of 7
(2,751 Views)

I guess you are running loop without delay, if yes keep a delay of 10ms inside the loop this will slow down the chart update rate.

-----

The best solution is the one you find it by yourself
Message 3 of 7
(2,748 Views)

Thanks for the help.  I tried this, but with waveform data (with timestamp) I only get every tenth point (or whatever size I'm using). The waveform chart just looks like a series of dots.  I wanted to try to make an array of data and pass to a UI loop via functional global, but using a feedback node to continually populate the array leads to a huge array.  What should I use in the DAQ loop and what should I use to retrieve the information in the UI loop?  I'm trying Array Subset, but a 2D Waveform array doesn't get cut to a 1D Waveform array...Cat Indifferent

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 4 of 7
(2,726 Views)

@Mr. Bass wrote:

Thanks for the help.  I tried this, but with waveform data (with timestamp) I only get every tenth point (or whatever size I'm using). The waveform chart just looks like a series of dots.  I wanted to try to make an array of data and pass to a UI loop via functional global, but using a feedback node to continually populate the array leads to a huge array.  What should I use in the DAQ loop and what should I use to retrieve the information in the UI loop?  I'm trying Array Subset, but a 2D Waveform array doesn't get cut to a 1D Waveform array...Cat Indifferent


It would be better if you can post the code ( in 2009 version ofcourse).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 7
(2,718 Views)

I would like post, but I have to do everything on an offline machine and it's a big pain to bring it over and upload an image (and my dev. computer is like 8 years old or more).  bah.  Thanks for the help.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 6 of 7
(2,696 Views)

This is a bare-bones and simple way of doing what you suggest.  

Simple delayed update graph.JPG



Never say "Oops." Always say "Ah, interesting!"

Message 7 of 7
(2,684 Views)