09-15-2011 07:00 AM
Hello,
I am querying a device for its settings. The device will return a code. What I would like to do is from the returned code assign to this code a piece of text (ie. "the instrument is on" for 1 or "the instrument is sleeping" for 2).
How do I do this?
Thanks,,
Nevica
Solved! Go to Solution.
09-15-2011 07:12 AM
It seems to me you are describing an Enumerated type. Use the enumerated type as an indicator and pass the code to the input. But that really doesn't give you a "text" string. Do you really want the result to be a string? That can be done using a case structure, or creating yourself an array of strings that matches the code and then using the returned code to select the index of you array.
09-15-2011 07:26 AM
How do I index an array. I think this is what I want!!!
Nevica
09-15-2011 07:46 AM
The simplest way...
09-15-2011 07:56 AM
Thanks, thats how I imagined it would work. But how do I create the 1 by 3 indexed string matrix (the purple box). I cannot find this anywhere. I am searching for indexed string and I cannot find in example finder!!!
Thanks,
Nevica
09-15-2011 08:05 AM
Place an array constant and a string constant on the block diagram.
Now drag the string constant into the array constant with your mouse. It should turn from black to pink.
Now you have created an "Array of string" constant.
09-15-2011 08:18 AM
Aha, that's how its done. thanks.