07-22-2011 07:42 PM
@compstopmer wrote:
When I change it to a while loop, the output doesn't register (the data only seems to exist inside the while loop and is wiped as soon it exits the while loop).
However, in the for loops, the data exists outside the for loop. Does anybody know why it happens this way? If I want to use a while loop, would I have to create a reference to a data field within the while loop?
It works the same for all loops. However, your code is a mess and cannot be judged from a picture. For example, You have three tunnels on the right border, but it is not clear what is connected to where, because the wires are hidden.
Select your loop and press the "cleanup diagram" button, or even better, attach the VI directly.
07-24-2011 08:53 AM
Altenbach covered the issues well.
If you connect the output of the Replace Array Subset to the shift register as I did in the image I posted, you would get the complete output. I only changed to a for loop so I would not need to guess when to press Stop for testing. It worked fine wtih the standard while loop.
Have you worked through the on-line tutorials for LV? These fundamental questions about the types of loops and shift registers should be covered there.
Lynn
07-25-2011 11:52 AM
Here's the VI I was describing.
07-25-2011 11:59 AM
And here it is with a replace array subset instead of insert into array.
I can get the for loop to work, but not the while loop
07-25-2011 12:31 PM
Your While Loop version is going to run super fast without limit. The only thing that stops it is the user pressing the stop button, and you have not timing structures inside of it to throttle the speed of the loop. It is going to run very fast, consuming all the resources it can accumulating millions upon millions of rows in an array. It will kill your screen update rate and may not allow the CPU any time to detect that a stop button has been pressed.
07-25-2011 12:43 PM
Hey guys, looks like adding the timing express vi solved the problem. I think most of you guys alluded to the fact that the while loop needs to be throttled in some way or fashion.
Thanks again for all the help