12-02-2014 02:28 PM
Hi everyone, I am using the LabVIEW "In Range and Coerce Function" specifically for coercion sake. I am only using the "Coerced(x)" output and I am NOT using the "In Range?" output.
I am feeding a number in and if it is less that 0 I was to coerce that number to 0 and feed it out the "Coerced(x)" output. I set the lower limit of the function to be "0" and did not wire the upper limit. When I do this my VI has a broken arrow and the way I was able to fix the broken arrow was to wire a constant to the upper limit input of the function. Why do I need to wire the upper limit if I am only using the lower limit for coercion? Is there another way around this? I just don't want to put a fake number in the upper limit just to satisfy the borken arrow issue.
Thanks!
12-02-2014 02:38 PM
The In Range needs a RANGE to test to. Therefore, you need an upper and lower limit. Just use +INF (if using double floating points) for your upper limit.
12-02-2014 02:43 PM
Simply use the Max&Min comparison function to return max(0,x).
12-02-2014 02:49 PM - edited 12-02-2014 02:51 PM
Hi,
I'm not an expert of any sort but it sounds like you might be better off using a "less than" node connected to a case structure. If it the number you are feeding the node is less than x then the case is "true" and you can have constant "0" feeding your indicator outside of the case structure. If the number you are feeding the node is NOT less than x then the case is false and you can just connect your input that you want to show in your indicator.
As an intermediate level user myself, I have to say using the HELP menu (ctrl+h) is a huge help. You'll notice if you put your mouse over the "In Range and Coerce Function" that all the inputs are in bold letters. Bold letters means that you WILL have a broken arrow unless something is connected.
Hope this helps!
After I posted this I saw the other replies and as usual there's an easier way than my method 🙂 but this can still be useful for other applications
07-27-2017 12:03 AM
What does it means. please tell
"The function performs the coercion only"
07-27-2017 12:29 AM
@Chishti wrote:
What does it means. please tell
"The function performs the coercion only"
Since this sentence was not mention in the old thread above, I guess you are talking about the help page. The full sentence is "The function performs the coercion only in Compare Elements mode.". Still unclear?
07-27-2017 12:58 AM
yes. In my opinion, if the value of 'x' is in the range of upper and lower limit it will return the value of 'x'. If not, then it will return the output value. Is it so?
07-27-2017 01:18 AM
@Chishti wrote:
yes. In my opinion, if the value of 'x' is in the range of upper and lower limit it will return the value of 'x'. If not, then it will return the output value. Is it so?
Your sentence makes no sense. It will always return an output value.
Did you understand my comment about the comparison mode?