10-15-2008 10:08 AM
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.
Solved! Go to Solution.
10-15-2008 10:14 AM - edited 10-15-2008 10:17 AM
Use a case structure and wire the number to the case selector. Now make cases for
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.)
10-15-2008 10:16 AM
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
10-15-2008 10:23 AM
This is what I come up with. Let me know if this helps.
10-16-2008 06:31 AM
Thanks for your replys guys, I used case structure with variable ranges (300..400, 400..500 etc.). Very convenient!
Thanks once again.