From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reinitialise/restart a loop when condition is true

Solved!
Go to solution
Hello, I have a program and at the end, if the number is >0, the condition is true. i want, when it's true, to reinitialise the while and restart it. the while is in a case strusture and in another while. i put the code here. tell me where i am wrong please :) thank's a lot.
0 Kudos
Message 1 of 6
(2,092 Views)

I don't understand what you are doing.  You say "if the number is >0", but you are comparing if one array of numbers is greater than an array of numbers {1,2,3,4,5,6}.  If when you convert those comparisons to a boolean array to a number, you see if that is greater than 0.  That is effectively the same as OR array elements.  If any of the values are greater than the corresponding element in  your 1...6 array, then you are true.  You stop the loop and do it all over again.

 

I'm not clear on what you are reinitializing.  If you want to reinitialize the queue point by point, then you should wire the boolean into that connector of the subVI.

 

I think you have one or two too many levels to this VI,  What is supposed to happen in the False case?    Other than the very first time this VI runs, and in that event, you wire a true into the shift register and immediately go into the true case.  It will never run the empty false case again.

 

You should be able to do this with a single while loop!

0 Kudos
Message 2 of 6
(2,072 Views)

thank's for the answer.

 

I just want : 

If the "x-y" > to the "array 2" (any value) so i can get a true value. then, if it's true, restart the loop and reinitialise all arrays (exept the array 2). if it's false, juste continue the while loop till it's true.

 

i don't know if i'm clear for you, i have a little english ...

 

hope you will understand

0 Kudos
Message 3 of 6
(2,068 Views)
Solution
Accepted by topic author siwalex

I still don't understand "restart the loop" because the loop would always be running to get new data in the event the condition is not true.

 

The decisions is to either reinitialize or not.  The loop always runs.

 

See attached for the simpler implementation.

0 Kudos
Message 4 of 6
(2,064 Views)

well done ! 

that's it !

thank's.

i understand now how to do with only 1 loop 🙂

 

my thank's to you.

just one question, how to simply done an array of 1000 lines with in all line the number 3?

thank's again. you save me 🙂

0 Kudos
Message 5 of 6
(2,060 Views)

Look up Initialize Array.

0 Kudos
Message 6 of 6
(2,058 Views)