Obtaining Enum Elements in String Format
Primary Software: LabVIEW Development Systems>>LabVIEW Base PackagePrimary Software Version: 8.2
Primary Software Fixed Version: N/A
Secondary Software: N/A
Problem:
I have an enumerated data type and I would like to obtain its elements in string format. Can I obtain the string data based on a user’s selection? Is there a LabVIEW function that can accomplish this?
Solution:
You can obtain a string indication of an enum type based on user input using one of the two following methods:
Method 1: Property Node with an Enum Control
If an enum control or indicator exists, create a property node for the enum and select the Strings[]property. This property returns an array of strings for the specified enum. Then use the Index Array function with the enum wired to the index terminal to access the desired string.
Method 2: Format Into String
If there is no enum control or indicator in the VI, wire the enum to the Format Into String function input; with a string value of %s wired to the format string input. This function returns the string value associated with the input enum value.
Figure 1: Property Node method and Format Into String method.
Related Links:
KnowledgeBase 36C8G0E6:Obtaining the String Selected from a Text Ring or Menu Ring
Knowledgebase 2WD8GR00: Programmatically Edit Items in a Menu, Text, or Ring List
Attachments:
- enum to string.vi
'via Blog this'
No comments:
Post a Comment