LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuing an array auto index after a while loop has terminated.

I have a nested while loop that runs for a number of iterations less than the number of elements in my array.

How do i ensure that on the next pass of the while loop the indexing continues from where it left off rather than going back to the start of the array every time?

Thanks!

0 Kudos
Message 1 of 5
(2,683 Views)

Hi niallc,

 

I have a nested while loop

How does that look like?

I guess you have more than one loop…

 

How do i ensure that on the next pass of the while loop the indexing continues from where it left off

Keep your own index counter in the loop.

Use shift registers to store that index value for the next iteration.

As usual in LabVIEW you use shift registers to forward data to the next iteration of a loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,680 Views)

So auto indexing is probably of.

 

So as GerdW mentioned, some shift registers are most likely required.

 

Instead of keeping the index in a shift registers, retrieving the element from a non-autoindexing array, you can also delete elements from the array that 'lives' in the shift registers.

 

(Arguably) a simpler concept. Sometimes convenient, but less efficient in most cases.Indexing in Nested Loops.PNG

Message 3 of 5
(2,628 Views)

In my case I like to use GetSet.vi witch is a functional global variable. with this one, you can even see the data from another loop or even from another computer.

Benoit

0 Kudos
Message 4 of 5
(2,609 Views)

"Continuing an array auto index after a loop has terminated in a functional global called GetSet.vi" doesn't add up...

 

 

You'll have to give a better explanation of what you want if you want us to help you. You like to use GetSet.vi how exactly?

0 Kudos
Message 5 of 5
(2,600 Views)