Enumerated type: Difference between revisions
Pbrooks100 (talk | contribs) |
Pbrooks100 (talk | contribs) mNo edit summary |
||
| Line 1: | Line 1: | ||
{{TOCnestright}} | {{TOCnestright}} | ||
Located under the Ring & Enum palette, a | Located under the Ring & Enum palette, a LabVIEW enumerated type is used to associate a '''sequential''' numerical value to a programmer defined string | ||
[[Image:Enum_Palette_Location_LV_7.1_and_below.png|frame|center]] | [[Image:Enum_Palette_Location_LV_7.1_and_below.png|frame|center]] | ||
Revision as of 17:30, 2 January 2008
Located under the Ring & Enum palette, a LabVIEW enumerated type is used to associate a sequential numerical value to a programmer defined string

Potential Uses
Enum's can be used with a case selector to provide the programmer an easy way to select a case based on a constant name instead of a number or a string.

Typedef'd Enum's are often used in State Machines to provide the programmer an easy way to select new cases without having to worry about spelling mistakes.
Recommendations
Enums are most commonly used to define a fixed list of cases. If the enum will be used as an input or output on the connector pane of a VI, it should be defined as a typedef. Any changes to the typedef can be automatically propagated to controls, indicators and constants created from the vi's connector pane.
Shortcomings
LabVIEW enumerated types do not allow for non-sequential values, or what might be known as sparse enum's.
