From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-03-2017 02:55 AM
I want a while loop to run inside another while loop, The second while loop should work indefinetely while go is pressed, if go is unpressed it stops but if go is pressed again it runs again...
What am I doing wrong?
Solved! Go to Solution.
04-03-2017 03:09 AM
Looking at the code nothing looks 'wrong'. You've got one while loop running inside another exactly as you've described. Can you describe what you expect to happen?
04-03-2017 03:25 AM - edited 04-03-2017 03:29 AM
Hi,
I think, you would disable the code inside of second while loop if do == false. But it is a "post testing" (do) while loop, so your code will be executed firstly, after LV checks your condition. So you have to wrap into a case structure your while loop (pre testing), and your while loop will be executed only if do == true.
Balint
04-03-2017 03:53 AM
I want the while loop with thw button GO to work when the GO button is green, and that it can be turn on and off again without restarting the whole program
The idea is not hard, I just don't know how to do it
04-03-2017 05:52 AM
It is all about my "Go" button....
04-03-2017 05:53 AM
I don't see "GO" button, only "DO".
04-03-2017 06:01 AM
Yes that one
04-03-2017 07:14 AM
Instead of a while loop inside of another loop, just use a case structure. Embedded loops are typically a poor solution.
04-03-2017 11:46 AM
What is the significance to adding the 3E-14 to the loop counter? After the first iteration of the outer loop, you will essentially be adding 0 to the loop count as the DBL precision variable will lose that resolution. Are you expecting that?
Loop 0: Sum = 3E-14
Loop 1: Sum = 1
Loop 2: Sum = 2
04-03-2017 12:19 PM
@Minions wrote:
What is the significance to adding the 3E-14 to the loop counter? After the first iteration of the outer loop, you will essentially be adding 0 to the loop count as the DBL precision variable will lose that resolution. Are you expecting that?
Loop 0: Sum = 3E-14
Loop 1: Sum = 1
Loop 2: Sum = 2
Maybe it is an attempt at mitigating some floating point precision issues?