LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

customize for loop to run from x value to y value

How can you customize a for loop to run from a specified i-value.

Basically how can I do this c code in Labview:

for(i=2; i<10; i++)
{....}
0 Kudos
Message 1 of 4
(3,007 Views)
You can do it using a while loop conditional on i<10, or have a case inside a for loop that is conditional on the i<10. For loops, in LabVIEW, execute for a specified number of iterations and don't actually have a means to terminate early, so the only way to simulate this it to have them loop more times than needed and have a conditional case statement inside that only executes during the appropriate iterations.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 4
(2,993 Views)
Guy04,

you cannot influence the iterator of any loops in LabVIEW. So there is (sadly) no way to initialize the iterator to a value != 0.
Nevertheless, you can "emulate" this by doing what i did in the screenshot. Just remember that "N" has to be the difference between end- and startvalue of your iterator (in your example 10 - 2 = 8 ).

hope this helps,
Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 4
(2,980 Views)
Hi Guy,

you can also emulate this for loop with a while loop and a shift register:

Message Edited by GerdW on 01-05-2007 10:20 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,978 Views)