02-10-2022 05:43 PM - edited 02-10-2022 05:43 PM
I want to build an array of a certain size by loops stopping when the array is full. I have to use a for loop and not use Boolean logic. I feel there's a connection to be made with the iteration count and count terminal but can't quite figure it out.
Solved! Go to Solution.
02-10-2022 05:52 PM
@User002 wrote:
I want to build an array of a certain size by loops stopping when the array is full. I have to use a for loop and not use Boolean logic. I feel there's a connection to be made with the iteration count and count terminal but can't quite figure it out.
Sounds like a homework assignment. Unfortunately I don't have LV 2020 installed on this computer. Would you mind saving for previous as LV 2018 so I can see what you have?
Thanks.
02-10-2022 06:00 PM
Not exactly. I realized I only knew one way of doing it and felt really limited.
02-10-2022 06:00 PM
You're generating random numbers and you only want to keep them if they fall in a certain range. It's not possible to know how many random numbers you'll need in order to hit your desired array size.
Maybe take a step back and explain what you're trying to do, and we can suggest a better way to do it.
02-10-2022 06:12 PM
@Gregory wrote:
You're generating random numbers and you only want to keep them if they fall in a certain range. It's not possible to know how many random numbers you'll need in order to hit your desired array size.
Maybe take a step back and explain what you're trying to do, and we can suggest a better way to do it.
That's why it seemed like homework to me. The constraints were so artificial that they sounded like a homework exercise. Yes, I agree that we need a better explanation of what the VI needs to do.
02-10-2022 06:40 PM
02-10-2022 08:37 PM
This is not homework. Majority was copied from homework about loops because it was a quick copy paste. I just wanted to see if I could build an array using the for loop.
02-10-2022 08:42 PM
@User002 wrote:
I just wanted to see if I could build an array using the for loop.
Yes you can. For example, you could place an inner while loop that tries over and over until a matching random number is found before the FOR loop can go to the next iteration.
02-10-2022 09:27 PM
So there's no way to determine the size of the array you want to build before it's built? I can't say the array's limit is 10 elements, for example, and then just "fill it up" with data? This is my first week with labVIEW, so I'm a little confused
02-10-2022 10:07 PM
@User002 wrote:
So there's no way to determine the size of the array you want to build before it's built? I can't say the array's limit is 10 elements, for example, and then just "fill it up" with data? This is my first week with labVIEW, so I'm a little confused
I don't understand the whole "limit" thing. Instead of creating an egg carton and filling it with eggs, why can't you just have a box of unlimited size and put twelve eggs in it?