LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement if condition

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. 

0 Kudos
Message 1 of 9
(3,435 Views)

>  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

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 9
(3,417 Views)

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..

0 Kudos
Message 3 of 9
(3,414 Views)

Something from here would work for you also.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 9
(3,367 Views)

Hi,

This can be used to check if the number is positive or negative

0 Kudos
Message 5 of 9
(3,310 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 9
(3,276 Views)

@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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 9
(3,267 Views)

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)

Message 8 of 9
(3,247 Views)

As always, leave it to Altenbach to show us all up.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 9
(3,233 Views)