LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update Waveform Chart with every new iteration/cycle of 10 data / horizontal slider control

Hello,

 

I know this may be very simple for any of you here. I am desperately needing help on this as mentioned in the subject. 

 

The CSV file attached contains 84 iterations of 10 data (rows) in each iteration and 8 columns of data (from col C to J).  

 

I want the Waveform Chart in the vi to display each new iteration until completed 84 iterations in every 50ms and the x-axis of the Chart should be displaying 0 to 10.

 

I also need to include a horizontal slider control as a purpose for the user to go back and forth (to select) which or any iteration number from 0 to 84 to be displayed in another chart/graph. Can anyone please suggest me where the control should be connected to?  

 

Please have a look at the code and suggest me what to be done to achieve my aim.

and please help me understand. Any help would be greatly appreciated.

 

 

Download All
0 Kudos
Message 1 of 21
(3,355 Views)

1. You array manipulation is WAY too complicated.  You can get the data you want just from that first Array Subset.

2. Turn off the autoscaling for the X axis and set it up so that it only displays the 10 samples.  You also have a multiplier on your scale to supposedly turn it into ms.

3. Store the data in a shift register and use Array Subset to get the data from the iteration you want for your second 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 2 of 21
(3,330 Views)

3. Store the data in a shift register and use Array Subset to get the data from the iteration you want for your second graph.

 

Referring to the screenshot, when you said store the data in a shift register.. do you mean the data coming into the graph? and is it correct how I connected the shift register? 

 

Where should the Horizontal Pointer Slider control "Access Iteration No." connect to? This is to display the data in second graph "subarray" according to the iteration number selected by the user.

 

Please have a look.

0 Kudos
Message 3 of 21
(3,305 Views)

Would it work for you to use the slider as the input into the (N) terminal of your for loop? That way, only the number of iterations that the user is interested in would be processed.

0 Kudos
Message 4 of 21
(3,281 Views)

Perhaps I've misunderstood what's you're looking for, but I think perhaps a separate loop would be the better choice. Connect the same data set to a While loop and use the slider to specify the index in the same way you use "i" in your current For loop.

 

You could use an Event Structure to handle the Value Change event of the slider, or just put a Wait function in your second loop to prevent it using all the CPU.

 

If you do use the Event Structure, be careful because I think a slider generates events many times per slide - this complicates processing significantly and might make either polling with a wait, or using the Mouse Up event more effective.


GCentral
0 Kudos
Message 5 of 21
(3,277 Views)

There is an error when I connected the slider as an input into the (N) terminal of my for loop. Its because I have two pointers in that slider, and the N only accept long data type.

 

Btw, I need to connect a constant (a number) to the N terminal too. So  maybe is there another way where I can connect the horizontal pointer slide that has 2 pointers in it?

0 Kudos
Message 6 of 21
(3,245 Views)

use the slider to specify the index in the same way you use "i" in your current For loop

 

Thanks cbutcher for your suggestion, but I don't understand in bold above. Can you please refer to my screenshot?

0 Kudos
Message 7 of 21
(3,243 Views)

I mean that where you currently use 'i', you could instead connect the slider.

 

Something like this (code modified from crossrulz's snippet above)

Example_VI_BD.pngYou'd probably want to make sure that the slider had an integer representation, but otherwise this should allow you to move back and forth.

 

An improvement would be to use an Event Structure, but as I mentioned, this has additional complication if you use a slider.


GCentral
0 Kudos
Message 8 of 21
(3,237 Views)

Okay, I got what you meant now. But the problem is, my horizontal pointer slider has 2 pointers.

 

The slider is a cluster of 2 elements (long data type) and the array subset (sink) only accept long. How do I fix this error?

 

0 Kudos
Message 9 of 21
(3,232 Views)

Ah - sorry. Is the intended purpose to set a range of iterations that should be continuously cycled through? If so, I'd suggest the following...

Example_VI_BD.png

 

Here the slider is unbundled, and when you reach the max, it resets to the minimum index.


GCentral
0 Kudos
Message 10 of 21
(3,228 Views)