LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For Loop

Solved!
Go to solution

Hi,
For loop in the LabVIEW will always iterate with minimum number of array inputs.
If I connect two array with sizes 3,5 then for loop will execute only 3 times. 
Is there any way to set it as maximum inputs?

0 Kudos
Message 1 of 7
(3,490 Views)

Hi Padmanaban,

 

Is there any way to set it as maximum inputs?

No.

Hint: Not with autoindexing enabled…

Questions:

- Which data should be used for the array input with less elements?

- How is this image related to your question? There is no FOR loop, and no arrays with different size…

Best regards,
GerdW


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

My input array will vary so like to do without using while loop.

0 Kudos
Message 3 of 7
(3,476 Views)

Hi Padmanaban,

 

without ANY loop:

check.png

Other option, also loopless:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,471 Views)

At first I thought this was a silly question, because why would you want to work on arrays element by element that are not the same size? There is one case when I do this though. When I need to put a cluster on a queue there is often a string containing a command and a variant containing data if necessary. To send multiple messages right after another, my SubVI takes an array of strings and array of variants, but not every command requires the variant data. Maybe I send 3 commands but only the 1st uses the variant.

 

In this case, I set the array of variants to have a normal, non-indexing tunnel, and put index array with the i (iteration) input as the index inside the loop. In this example, i=0 will have an associated element, but i=1,2 will return the default for that array type, an empty variant, which is desired in this case.

0 Kudos
Message 5 of 7
(3,416 Views)
Solution
Accepted by topic author PadmanabanJ

Or you could use the for loop

forere.PNG

Yeah, I know... But I just thought I would show how you could do it with the for loop and unknown array sizes. 😛

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(3,401 Views)

@RTSLVU wrote:

Or you could use the for loop

forere.PNG


Instead of the Greater and Select, just use the Max & Min node.  I find it easier to understand than the two nodes together.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,369 Views)