09-21-2018 01:48 PM
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.
09-21-2018 01:52 PM
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.
09-21-2018 02:55 PM
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.
09-21-2018 03:40 PM
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.
09-24-2018 06:42 AM
@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
09-24-2018 07:26 AM
@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...