11-04-2014 12:13 PM
Hi everyone,
Please see the attached file. I've added notes where the data goes missing. I know it has something to do with auto-indexing and I spent quite a bit of time reading about it and trying different things but I really need some help now please.
Thank you!
Solved! Go to Solution.
11-04-2014 01:19 PM
Two of your three 2D arrays that are AutoIndexing inputs to the for loop are empty the for loops will iterate 0 times
11-04-2014 01:29 PM
Sorry, I attached the wrong file! This one should work.
11-04-2014 01:30 PM
To expand on Jeff's post a little bit, the multiple auto indexing tunnels on a FOR loop are fine but the FOR loop will only iterate as many times as the least-filled array (for the dimension you're indexing). In the inner loop, it will never iterate more than 2 times because of your D-E button array, regardless of the dataset you use.
11-04-2014 01:59 PM - edited 11-04-2014 02:02 PM
@Zwired1: I tried adding a constant to the count terminal but it didn't seem to make a difference. Is there a way to fix this? Can you point me in the right direction?
11-04-2014 02:06 PM
Think about what you're trying to do.
You have three arrays you're indexing. Let's say they're lengths 1, 2, and 3.
In the first iteration, we'd index 0 and get back a value from all three.
In the second iteration, we'd index 1 and get back two values and have a bounds conflict.
In the third iteration, we'd index 2 and get back a single value while having two bounds conflicts.
Anything you process in the second and third iteration is garbage. You have bad inputs so the output isn't useful to you. In some languages, this will throw an error at runtime for indexing out of bounds. Some will just let you process the garbage. In no case do you WANT to run this.
If you want to process all the elements of the array of size 3, you need to fill in values for the first to arrays to make them all have a length of 3. Once you do that, the loop will run as you desire. If you have auto-indexed tunnels with fewer elements than the constant you wire, they will override the terminal, as they should.
11-04-2014 02:18 PM
So what I understand from your post is that all my arrays have to be the size of the largest one, is that right?
11-04-2014 02:20 PM
11-04-2014 02:22 PM
Your very big loop (and it's inner loop) will spin as many times as the smallest array of the 4 entered. Why dont you simply make a a loop for each of the arrays?
/Y
11-04-2014 02:25 PM
@Yamaeda: so one while loop with 4 for loops? Oh yeah, that would work! I'm going to give that a try.