10-17-2014 03:53 PM
Hello,
I am trying to figure out how to connect a single user's input string value to numerical values. Basically I want the user to input the name of a gas that I have a list for (I believe i put the list of gasses in an array>). Then I want to match 2 numerical values "a" and "b" depending on which gas name the user has put in. These "a" and "b" values will be automatically matched with the gas name from a list I put. For example the gas hydrogen has a value of 3 for "a" and 4 for "b. so when the user puts the name "hydrogen" in a string constant, automatically "a" and "b" should be outputted. I will be connecting a and b to a formula
Thanks for any help
Solved! Go to Solution.
10-17-2014 04:02 PM
Hi,
maybe it is not exactly what you are looking for, but maybe you could use enumerated data type and the array of clusters of the items (a, b).
Look at the VI I have attached.
10-17-2014 04:06 PM
Didn't quite understand all of your problem description but I think you are looking for the Decimal String to Number VI in String > Number/String Conversion palette.
10-17-2014 04:12 PM
It sounds like you want to take an input of a String type and search through an array to determine which element it is and then extract more information as a result.
You can search an array and get the element returned. If you want to contain more information, you can look at a 2D array or an array of clusters to retrieve the 'a' and 'b' values, whatever they're supposed to be.
Of course, this is going to require a bit of work to build the array constant manually.
What is the homework problem you're working on actually asking for?
10-17-2014 06:07 PM
student11 wrote: These "a" and "b" values will be automatically matched with the gas name from a list I put. For example the gas hydrogen has a value of 3 for "a" and 4 for "b".
This sounds a lot like an Enum to me. Make sure you type def the enum to make sure updates quickly and easily make it to all copies of the enums.
10-17-2014 11:29 PM
This is exactly what I am looking for thanks. The hw assignment wants a user input to type a gas name, then it goes into a formula (a and b values depending on user input in string for gas name). Then of course an output value from the formula is formed.
10-18-2014 12:25 AM
I am sorry I have a quick question. I understand this is an array constant. I can't figure out how to put the a and b values like you did here. How did you label these number constants in this array as a and b and grouped them together like this? Any help is appreciated.
10-18-2014 01:07 AM
Hi, try this. Hope it helps.
10-19-2014 08:43 PM
That is perfect thank you so much.