04-01-2013 12:26 AM
Hi all,
I am doing project on Labview. my doubt is how to find weather the given number is positive or negative. and how to implement 'if' condition in labview.
04-01-2013 02:02 AM
> I am doing project on Labview. my doubt is how to find weather the given number is positive or negative. and how to implement 'if' condition in labview.
Labview has function blocks that implement features like "Greater than or Equal to Zero" on the comparison pallette.
"Returns TRUE if x is greater than or equal to 0. Otherwise, this function returns FALSE."
That might be a good place to start.
Also check out the free tutorials- it will save you a lot of time and frustration.
steve
04-01-2013 02:07 AM
For your current application you can make use of what steve has mentioned.. In general, you can use case structure to implement if or if-else conditions..
04-01-2013 10:08 AM
Something from here would work for you also.
04-04-2013 06:40 AM
Hi,
This can be used to check if the number is positive or negative
04-04-2013 11:05 AM
@dprathima14 wrote:
Hi,
This can be used to check if the number is positive or negative
Interesting. You borught up a valid point. "Not negative" is NOT the same as "positive or negative" - which implies "NOT zero," since zero is neither positive nor negative.
04-04-2013 11:20 AM - edited 04-04-2013 11:21 AM
@dprathima14 wrote:
Hi,
This can be used to check if the number is positive or negative
Here's a simpler way to do the same thing. The three cases are "..-1", "0", and "1..". The ".." gives a range. So in this case "..-1" is all numbers -1 and less (aka, all negative numbers).
04-04-2013 04:07 PM - edited 04-04-2013 04:13 PM
Many times you can avoid case structures entirely, with the advantage that all code is visible at the same time. This makes the code understandable and self-documenting, even from a simple, flat code image alone.
Here's what I would do.
(Compare this for example with the code of dprathima14 above, that has stacked case structures and three different dialogs that cannot be distiguished without double-clicking them)
04-04-2013 05:21 PM
As always, leave it to Altenbach to show us all up.