LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using comparison with case structure

Is there an easier way to do the following vi?
 
I heard that you can use a comparison with a case structure but how can it be done?
 
-Thanx
0 Kudos
Message 1 of 7
(4,057 Views)
Wire your row or column into the case selector. You should use integers and not floating point numbers. In the value field of the case selector, you can either type a specific number or a range. To handle all values (to use your example) less than or equal to 32, type ..32. To handle 32 to 64, enter 33..64, etc. Right click on a case structure and select Help. You should see a link called "enter a single value or lists and ranges of values".
Message 2 of 7
(4,050 Views)
In addition to Dennis' comments I would eliminate the global variables. I modified a small portion of your VI as an example.

Lynn
Message 3 of 7
(4,040 Views)
If operations are the same in each case, they belong outside the case. Only the code that differs belongs inside the case.
 
Here's a suggested alternative. It is "slighly" simpler but should give the same result. It is 13x smaller (66kb vs 843kb) and does not need any global variables.
 
(To sreamline it even more, I would use the lookup table approach as described on the diagram)

Message Edited by altenbach on 07-19-2005 09:34 AM

Message 4 of 7
(4,034 Views)

You guys and gals are great!

Thanks for all the feedback, hopefully one day i will be on your level!

 

-FredFred

0 Kudos
Message 5 of 7
(4,022 Views)

Just as an additional alternative, you could get rid of all case structures. 🙂

See attached example (LabVIEW 7.1, I took the VISA stuff out for simplicity.)

Message Edited by altenbach on 07-19-2005 06:08 PM

Download All
0 Kudos
Message 6 of 7
(4,008 Views)
Nice!

You will still need a case structure or something similar (such as setting range coercion on the Row and Col controls) if you need to handle out of range inputs.

Lynn
0 Kudos
Message 7 of 7
(3,989 Views)