LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto index only shows partial data

Solved!
Go to solution

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!

Download All
0 Kudos
Message 1 of 53
(3,367 Views)

Capture.PNGTwo of your three 2D arrays that are AutoIndexing inputs to the for loop are empty the for loops will iterate 0 times


"Should be" isn't "Is" -Jay
Message 2 of 53
(3,347 Views)

Sorry, I attached the wrong file!  This one should work.

0 Kudos
Message 3 of 53
(3,338 Views)

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.

Message 4 of 53
(3,333 Views)

@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?

0 Kudos
Message 5 of 53
(3,318 Views)

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.

Message 6 of 53
(3,313 Views)

So what I understand from your post is that all my arrays have to be the size of the largest one, is that right? 

0 Kudos
Message 7 of 53
(3,302 Views)

@rhupd wrote:

@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?


Autoindex has higher priority than Count terminal, it'll loop no more than before.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 53
(3,300 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 53
(3,299 Views)

@Yamaeda: so one while loop with 4 for loops?  Oh yeah, that would work!  I'm going to give that a try.

0 Kudos
Message 10 of 53
(3,292 Views)