LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

arrays in for loops

Solved!
Go to solution

Hi, 

I am trying to put values into an array using for loop. My requirement is to insert the value into the output array only if i mod 2 is equal to zero. Otherwise, I do not want to pass anything to the array. The problem arises because I cannot leave the output tunnel unwired in the 'False' condition of the case structure. So I tried wiring a constant value of 0. Now my result array has zeros also. How can I modify this VI so that I get an array like 0 2 4 6 etc?

 

Thanks in advance

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

Wouldn't it be easier to simply multiply [i] by two and run the loop for only half the current number of iterations?

 

(You have LabVIEW 2012, so there is also the condtional output tunnel that could do what you want.)

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

Hi,

That is a sample code I attached. Not the actual problem I am working on. I want to pass a value to the output array only if the case condition inside the for loop is true. Otherwise, I do not want anything to be passed to the array. Kindly help

0 Kudos
Message 3 of 5
(2,699 Views)
Solution
Accepted by topic author annakurian

@annakurian wrote:

Otherwise, I do not want anything to be passed to the array. Kindly help


I already mentioned conditional tunnels. See here for details. See how far you get. 😄

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

Thanks a lot for the reply. I tried using the conditional output terminal on the for loop and it seems to work 🙂

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