Jump to content

Possible to set cases based on variables?


Recommended Posts

I have one variable I need to compare against several other variables in order to choose which case to run. It's easy to do in text languages using ElseIf or Select statements, but I can't figure out if it is possible for Labview case structures to be defined by variables.

Pseudocode[/u]If A<W then [u]
Link to comment

QUOTE(Daklu @ Aug 17 2007, 02:57 PM)

I have one variable I need to compare against several other variables in order to choose which case to run. It's easy to do in text languages using ElseIf or Select statements, but I can't figure out if it is possible for Labview case structures to be defined by variables.
Pseudocode [/u]If A<W then   [u]

The syntax is in the online help for the case structure. In general, wire the variable to the selection terminal (the '?' terminal) and then put the test in the case selector. For numerics:

..1 is anything less than or equal to 1

3..5 is anything between 3 and 5 inclusively

4 is just 4

4.. is anything greater than or equal to 4

default is anything not covered by any case

..1, 3.. is anything less than/equal to 1 or greater than/equal to three.

Link to comment

QUOTE(Daklu @ Aug 17 2007, 12:57 PM)

I have one variable I need to compare against several other variables in order to choose which case to run. It's easy to do in text languages using ElseIf or Select statements, but I can't figure out if it is possible for Labview case structures to be defined by variables.
Pseudocode[/u]If A<W then[u]

Yes this is quite easy to do. If you want to implement precisely what you've written, use the Less Than function from the Comparison pallette and wire its boolean output to the input of your Case Structure.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.