LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I increment a For loop is steps of 2 instead of 1

Instead of the standard plus 1 each time threw the for loop is it possible to get labview to increment it with a step size of 2.
0 Kudos
Message 1 of 4
(9,775 Views)
For loops always iterate by 1. You can multiply the current iteration "i" by 2 for the effect of stepping by 2.
Message 2 of 4
(9,775 Views)
Not possible, but can be done by doing some coding.

For example put one case structure inside your loop and toggle one boolean constant. Put everything that you want to run inside the true case and wire the case with "toggling boolean wire". Something like that. Think you get what I mean. Many way of doing this.
------------------------------------------------------------------
When you feel sad, laugh
0 Kudos
Message 3 of 4
(9,775 Views)
Multiply the index by two and divide the number of iterations by two (make sure that you add 1 for the zero iteration). For example, if you want to do a for j = 0 to 10 step 2 then you could use a value of 6 for N and multiply i by two each time through the loop to get the current value of j. You can use similar methods if you want to start the loop at something other than 0, etc.
Message 4 of 4
(9,775 Views)