LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

If I have floating values such as 6.3, 6.7, 6.9, 7.1, 7.2 how do I write a case statement to handle that

Solved!
Go to solution

altenbach wrote:

It is unexpected that an input equal to the second element also results in NaN. That might be a bug. (see image).

 


Why is it unexpected, the upper value is inclusive? 

 

Threshold 1D Array Function

Owning Palette: Array Functions

Requires: Base Package

Interpolates points in a 1D array that represents a 2D non-descending graph. This function compares threshold y to the values in array of numbers or points starting at start index until it finds a pair of consecutive elements such that threshold y is greater than the value of the first element and less than or equal to the value of the second element.

 

It may have been this inclusiveness that drove me to IR&C in the first place.

0 Kudos
Message 11 of 13
(376 Views)

OK, then the behavior in my second case is incorrect. an input of 2 should give a zero, not a 1.

 

If the element matches exactly, the result is the same as the output of "search array". Is this compatible with the text of the help?

 

Maybe I am just confused....I don't even understand the "2D nondescending graph" part, but maybe that's just some math lingo (a google search for the term returns the quoted labview help as first match! :o). Where does the second dimension come from?

 

While the help describes what it compares, it does not really say what it returns...

0 Kudos
Message 12 of 13
(369 Views)

@altenbach wrote:

OK, then the behavior in my second case is incorrect. an input of 2 should give a zero, not a 1.



Again I have to disagree.  1 is an allowed value for the fractional index (ignore rounding for the moment) zero is not.  When you input 2 the integer index is zero since the first region is being interpolated.  The fractional index (y-y[i])/(y[i+1]-y[i])) is equal to 1 so the result is 0+1=1.

 

Edit: fixed blunder in fractional index formula.

Message 13 of 13
(366 Views)