LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure input real numbers

Apparently, case structures only allow string or integer values for the selection input.
I have a situation where there are multiple ranges of real decimal data and need to select an action dependent on them.
 
Is it possible to use ranges of real decimal numbers in a case structure?\
 
0 Kudos
Message 1 of 4
(4,464 Views)
Dear Wes_OH,
 
It is not possible to give directly a floating point number to a case structure. However, there is an indirect solution, you can multiplier your floating number by 10,100,...
 
After thinking that, I found a KB with an example on the following link: Can I use Floating Point Ranges in LabVIEW Case Structures?
 
Best regards
Nick_CH
Message 2 of 4
(4,450 Views)

I like it.

Simple solution.

0 Kudos
Message 3 of 4
(4,447 Views)

Another easy possibility is the use of "threshold array" with a sorted array of "boundary locations" (see image).

Be aware that if you are very close to a boundary, the normal precautions for comparing DBLs apply.

(You can easily modify the desired behavior by rounding up or down. Also be aware that anything outside the range will be stuffed into the closest border range. The code in the image creates four ranges: 2.5 and below, 2.5..8, 8..10, >10. Modify as needed)

Message Edited by altenbach on 03-01-2007 09:56 AM

Message 4 of 4
(4,437 Views)