LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure and strings?

I am trying to create a case structure with a couple different cases to change units in a problem. I already have the code for the units, but not sure how to use a case structure with strings. I would like to have a drop down menu in the front panel in which you can select the type of unit that you want to use, and thus the case structure would then execute the code within that case to display the proper units. Is there a certain thing I should connect to the selector terminal to do this? I am trying to sort it out now using an array, not sure if that is the correct way to go or if it is how to exactly configuring it correctly. Thanks.

 

0 Kudos
Message 1 of 6
(5,514 Views)

For your front panel selection use an ENUM instead and then wire that to the case structure. I highly recommend that you save the ENUM as a typedef.

 

With strings you wire the string wire to the selector and then type the desired strings in the upper case selection value. You can right click on the case structure and specify that case doesn't matter for matching strings. String matching will need to be exact matches with the exception of case which is optional.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 6
(5,512 Views)

thanks that helped a lot. Another one-how do you use the same variable in multiple cases? now that I have the two different interchangeable unit cases, I have 2 different spots that the values are outputting in the front panel when I change cases. thnx.

0 Kudos
Message 3 of 6
(5,484 Views)

Your case statement should be within a While loop. Your output value should be a wire that run throughs the case statement and into a shift register on the while loop. Basic case.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 6
(5,479 Views)

@mshask wrote:

I am trying to create a case structure with a couple different cases to change units in a problem. I already have the code for the units, but not sure how to use a case structure with strings. I would like to have a drop down menu in the front panel in which you can select the type of unit that you want to use, and thus the case structure would then execute the code within that case to display the proper units. Is there a certain thing I should connect to the selector terminal to do this? I am trying to sort it out now using an array, not sure if that is the correct way to go or if it is how to exactly configuring it correctly. Thanks.

 


JKI - State Machine might help your question. Follow up this link

http://sine.ni.com/nips/cds/view/p/lang/en/nid/20902

https://resources.jki.net/state-machine

0 Kudos
Message 5 of 6
(5,425 Views)

@SabariSaravanan.M wrote:

@mshask wrote:

I am trying to create a case structure with a couple different cases to change units in a problem. I already have the code for the units, but not sure how to use a case structure with strings. I would like to have a drop down menu in the front panel in which you can select the type of unit that you want to use, and thus the case structure would then execute the code within that case to display the proper units. Is there a certain thing I should connect to the selector terminal to do this? I am trying to sort it out now using an array, not sure if that is the correct way to go or if it is how to exactly configuring it correctly. Thanks.

 


JKI - State Machine might help your question. Follow up this link

http://sine.ni.com/nips/cds/view/p/lang/en/nid/20902

https://resources.jki.net/state-machine


JKI - State Machine to convert to a unit based on a string?

 

Seems a bit (understatement) overqualified to me...

0 Kudos
Message 6 of 6
(5,420 Views)