10-27-2017 02:21 AM
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?
Solved! Go to Solution.
10-27-2017 02:24 AM - edited 10-27-2017 02:25 AM
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…
10-27-2017 02:37 AM
My input array will vary so like to do without using while loop.
10-27-2017 02:45 AM - edited 10-27-2017 02:47 AM
10-27-2017 01:30 PM
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.
10-27-2017 05:17 PM - edited 10-27-2017 05:23 PM
Or you could use the for loop
Yeah, I know... But I just thought I would show how you could do it with the for loop and unknown array sizes. 😛
10-30-2017 08:34 AM
@RTSLVU wrote:
Or you could use the for loop
Instead of the Greater and Select, just use the Max & Min node. I find it easier to understand than the two nodes together.