LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Increment within a case structure

I'm trying to increment by 1 only when a case is true. The case is under a FOR loop. That is, in a text-based program, 'x=x+1' with 'x' initialized to 0, is put under a 'IF' statement and this 'IF' stement is under a 'FOR' loop. Can anybody tell me how to implement this in LabVIEW ?
0 Kudos
Message 1 of 3
(4,122 Views)
You can use a shift register. To add a shift register to a 'For' loop, right-click in the border of the loop and select "Add shift register". You can initialize by wiring a constant to the left shift register.

The attached vi use a "For" loop go through an array and count the number of zeros in the array. (Make sure you input some numbers first in the array 🙂 )

Hopefully, this can help you with your situation.

Best regards;
EJV
www.vartortech.com
0 Kudos
Message 2 of 3
(4,122 Views)
Hi,

nothing that easy.. do following:

1. place your loop, create a shifting register and wire a constant (zero) to
it
2. create the case structure inside the loop and wire your condition
3. join the shifting registers throught all case statements
4. insert from the numeric palette the +1 function into the selected case

Hope that helps
Henrik

jh_sns schrieb in im Newsbeitrag:
50650000000800000009240000-993342863000@exchange.ni.com...
> I'm trying to increment by 1 only when a case is true. The case is
> under a FOR loop. That is, in a text-based program, 'x=x+1' with 'x'
> initialized to 0, is put under a 'IF' statement and this 'IF' stement
> is under a 'FOR' loop. Can anybody tell me how to implement this in
> LabVIEW ?
0 Kudos
Message 3 of 3
(4,122 Views)