LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

making a special default case

Hi all,

 

I have a case structre in a for loop.  The loop will loop for 50 times.  I place some code in the case structre for when i = 1, 10, and 15.  When i is equal to other values, I want a default case.  How do I do that?  I don't have to create cases that include all the possibilities, do I? 

 

Also, is there a way to programmatically create conditions in case structure?   

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 7
(2,938 Views)

CaseExample.png

 

The other case is simply 'Default'

 

As to part two of your question, do mean generate the case structure programmatically as in scripting?

Message 2 of 7
(2,934 Views)

Are you saying that I can just create a case called "default" with no number associate with it? 

 

Yes, I want to create the condition with the user specifying the condition.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 7
(2,910 Views)

jyang72211 wrote:

Are you saying that I can just create a case called "default" with no number associate with it? 


You can right-click on any case and select "Make this the default case" (or some such words like that). This is explained in the LabVIEW Help.

 


Yes, I want to create the condition with the user specifying the condition.

You cannot create cases at runtime. The scripting method allows you to programmatically create a case structure from some source, like a list of strings. But this is an edit-time operation. You will need to design your code to handle a user-specified condition. Can you provide more details on what this condition is?

 

0 Kudos
Message 4 of 7
(2,907 Views)

jyang72211 wrote:

 

 

Yes, I want to create the condition with the user specifying the condition.


Am I the only one with Kenny Rogers and the First Edition stuck in my head...And feeling a strange urge to go Bowling?

 

If you provide details on the condition I can tell you what condition your condition is in...

 

 

0 Kudos
Message 5 of 7
(2,896 Views)
You cannot programatically change the case structure during run-time.  However, one implementation of what you want to do is inthe VI I included.  Essentially you have an array of values that you want to match up to the iteration value.  This is sent through an equals VI block and then all values go through the OR block to come out with whether or not that there was a match somewhere within that array.  The iteration terminal isn't directly wired up, but this will do what you want to do.
National Instruments
Applications Engineer
0 Kudos
Message 6 of 7
(2,871 Views)

Thank you all.  Your information helps a lot.

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 7 of 7
(2,832 Views)