02-03-2014 02:43 PM
Hi Guys,
I feel like this is a dumb problem and know the solution if probably obvious, but I can't seem to find it 🙂
I have a for loop with several inputs and outputs in a subvi. When the subvi is run all the inputs are read, the for loop is skipped over, and the outputs are sent out. Does anyone have any idea of why the for loop is being skipped? Everything seems to be wired corretly??..
The vi is attached.
Thank you!
Christopher
Solved! Go to Solution.
02-03-2014 02:50 PM - edited 02-03-2014 02:52 PM
I cannot open your code due to my having LabVIEW 2009, however here is one thing to check: Do you have auto-indexing on at all? Perhaps it is not executing the expected amount of times due to an array being wired as "auto-index" to your for-loop?
Another thing to check is try placing an indicator on the output of the "N" and "i" variables of the for-loop (the blue box letters that automatically appear). This should tell you the "N"umber of times it will iterate and the value of the current 'i'teration.
When you use Highlight Execution, do you see it execute any of the code inside the loop? If so, how many times? And how many were you expecting?
02-03-2014 02:57 PM
Hi, Thanks for the reply.
The loop is running 0 times. About half of the inputs are auto indexed, and I checked to be sure they were initialized before I ran. I saved the vi as version 8, so hopefully it will open for you.
Thank you!
Christopher
02-03-2014 02:58 PM
I think HappyAsthma has it right here.
Check the sizes on each of the arrays in outputcluster3 and LastState.
Number of iterations of your for loop will be set by the smallest indexing array size which is likely zero in your case.
02-03-2014 02:59 PM
Pictures of the start and finish of the code are attached.
Thank you!
Christopher
02-03-2014 03:02 PM
The VI you posted has empty arrays and will index 0 times.
If you're actually passing data in all of your indexing arrays, the loop will work as expected.
If there is data that you want to show, do a Set Value to Default on your relevant controls before posting your vi.
02-03-2014 03:03 PM - edited 02-03-2014 03:03 PM
Please run the calling VI with the front panel of this subVI open. unitl the problem occurs. Stop everything and go to the subVI front panel, and do a "edit...make current values the default". save the subVI under a new name and attach it here.
02-03-2014 03:05 PM
Yes he was, I changed the number of values in the array from 0 to 23 and it works! Thank you!
Christopher