LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to program multiple "if" conditions?

Solved!
Go to solution

Hi,

 

Could someone please tell me or give an .vi example of how to program simple comsprison cases:

 

I have a FOR cycle which iterates from 300 to 800. I need to do different tasks when the iteration becomes 400, 500, 600 and 700. How to that in simplest and nicest way?

 

Thanks in advance.

0 Kudos
Message 1 of 5
(2,953 Views)
Solution
Accepted by testas123

Use a case structure and wire the number to the case selector. Now make cases for

  1. ...299 (default)
  2. 300..399
  3. 400..499.
  4. 500..599
  5. 600.699
  6. 700..

See how far you get. 🙂

 

This assumes you want to switch to a different task and keep it until the next level.

 

(If you want to do a different ask only at specific single iterations, you would only make single numer cases, of course. Your descriptions can be interpreted both ways, so it's not entirely clear.)

Message Edited by altenbach on 10-15-2008 08:17 AM
0 Kudos
Message 2 of 5
(2,944 Views)

Use a case structure inside the for loop.  Wire the "i" node to the selection terminal of the case structure.  When an integer is connected to the case selector, the cases take on numerical values.  You can define ranges by typing 400..499 for example.  A default case is always a good idea when using Numeric or String selector data types.

 

Lynn 

0 Kudos
Message 3 of 5
(2,943 Views)

This is what I come up with.  Let me know if this helps.

 

 

Ron Deavers, CLD
Download All
0 Kudos
Message 4 of 5
(2,934 Views)

Thanks for your replys guys, I used case structure with variable ranges (300..400, 400..500 etc.). Very convenient!

 

Thanks once again.

 

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