‎05-30-2012 02:59 PM
hello,
i have a problem with the following:
it starts and doesnt end. only the first "m" and "b" gets inside the while loop. afer "=" there is false. Why is this while loop standing still?
‎05-30-2012 03:16 PM
How do you know it is standing still ?
What if it can't find a true, how do you stop it ?
‎05-30-2012 03:18 PM - edited ‎05-30-2012 03:22 PM
The stop condition is that your number has to equal zero. You did not get a zero so the loop does not stop. You could try less than or equal to zero for a stop condition. Put a probe on the number feeding into your condition.
‎05-30-2012 03:33 PM
ok, that could be the reason.
Good idea with the less than or equal to zero for the stop condition.
But this would only function, if the line-value begins with a value/values less than the values of the comparing array.
So i have to set a case structure for this i think.
‎05-30-2012 03:34 PM
You could also make it without a while loop:
‎05-30-2012 03:39 PM
@dkfire wrote:
You could also make it without a while loop:
One thing to note about the above code. If the input arrays are not the same size the loop will only run a number of times equal to the length of the shortest array. If an empty array was input the loop would not run.
‎05-30-2012 03:40 PM
You can also use the in range (on the comparison palette) and define the upper and lower limits of when you want it to stop.
‎05-30-2012 03:53 PM - edited ‎05-30-2012 04:01 PM
this code looks nice. instead of searching for the 0 i could square the values in the array and search for Min.
I will try this tomorrow. I think there are some other mistakes in my vi on top, because "array with x values" and "array with indizes" (the lower lines) are on 0 when the program runs and nothing varies. But the first point has the coordinates y=0, x=90.
edit: the arrays have the same length.