07-26-2013 01:54 PM
I am successfully filling an array and now trying to iterate through each element and output it from my VI.
The problem I am having is the for loop iterates through without sending the value to my indicator. I have flipped through all tunnel options and placed the indicator inside the for loop. From my programming background, my logic seems sound. Enter loop>Process element>Output element>Repeat loop until condition is met. What is the missing piece that I can't seem to translate into Labview code?? Thanks.
Solved! Go to Solution.
07-26-2013
02:01 PM
- last edited on
05-09-2025
08:02 PM
by
Content Cleaner
First off, you were right with your instincts to put the indicator inside the loop. Do that.
For example, you could do something like this to wait 1/10 second between each number of an array:
Something to keep in mind, the little [] symbol on the left entry tunnel is for Auto Indexing. This will iterate through every element in the array. However you also are hard wiring in to loop 20 iterations. This will automatically default to the SMALLER of the choices. (either 20 or array.size).
07-26-2013 02:21 PM
amacapa wrote:
From my programming background, my logic seems sound. Enter loop>Process element>Output element>Repeat loop until condition is met. What is the missing piece that I can't seem to translate into Labview code?? Thanks.
Except the output of the FOR loop is not available until all of the iterations of the loop have completed. By putting the indicator inside of the loop, it will then be updated with each iteration.
07-26-2013 02:47 PM
Thank you for your reply Mr. Happy! I fixed my code with your suggestions.
The probe 1 shows that it is going through all the elements now, but the output of the VI is stationary until the loop is completed. The only output is the final element. Am I still missing something?
07-26-2013 02:53 PM
07-26-2013 02:59 PM
Hmm, I see. Well back to the drawing board. Thank you for all of your help!
07-26-2013 03:07 PM
One way to monitor each element being worked on is to simply make this FOR loop a wrapper for everything you are doing with the array elements (adding subVIs inside it). Then, compile all your results into your solution and take that out of the loop (unless just seeing all the individual data are what you want and you just stop, or you could write the whole kit and kaboodle to a file as text, graphs,pictures, whatever, to be deciphered later).
Cameron