01-26-2011 08:14 AM
Hey Friends,
if i want to make a program (if the input is x and L).
if the x is less than -L output must be 0
if the x is between -L and 0 output must be 1
if the x is between 0 and L output must be 2
if the x is more than L output must be 3.
What should be done(since there isnt any if then else commnad in labview)?
Thanks in advance
Regards
01-26-2011 08:22 AM
@interstellar wrote:
(since there isnt any if then else commnad in labview)?
The "else" in LabVIEW is the false case
IF x Then (do the True case) else (do the False case)
Just like you nest IF ELSE statements in text based, you also nest True/False cases in LabVIEW
01-26-2011 08:29 AM
Thanks.. is there any other way?
01-26-2011 08:32 AM
The case selector will accept a number. You can also have ranges for a case (e.g. 0..5 is zero to five).
Check the help on case structures.
http://zone.ni.com/reference/en-XX/help/371361B-01/glang/case_structure/
http://digital.ni.com/public.nsf/websearch/A5D77ADCA661670386256A480062A340?OpenDocument
01-26-2011 08:33 AM
01-26-2011 08:35 AM
01-26-2011 09:04 AM
I know you can do this with a formula node. Not sure how performance compares to other methods.
01-26-2011 09:36 AM
Thanks for your reply..
cant the range be variable.. like for this case L?
01-26-2011 09:40 AM
DON'T DO THIS!!!! There's a note in a style guide, somewhere, that says something ugly about nesting too many Case Structures. It's tempting, though, and more analagous to If-Then-Else than my first response.
01-26-2011 10:06 AM
I did this initially but this did not look nice and was difficult to understand..
What if i want to use case structure. like what vt92 said
The case selector will accept a number. You can also have ranges for a case (e.g. 0..5 is zero to five).
Check the help on case structures.
http://zone.ni.com/reference/en-XX/help/371361B-01/glang/case_structure/
http://digital.ni.com/public.nsf/websearch/A5D77ADCA661670386256A480062A340?OpenDocument
cant in place of number a variable be used? like in my example 'L'...