07-10-2007 01:17 PM
07-11-2007 03:44 AM
07-11-2007 07:05 AM
Thank you, but what I got there are rings, which can be sparse in LV.
Can you do the same with an enum?
07-11-2007 07:10 AM
Or did you already use an enum and this process simply converts it to a ring?
The article is from before LV 7.0 was released (which I believe was the first version which had sparse rings), so it's possible it never did produce sparse enums, but I saw people say that they did use this process to create sparse enums in LV. I suppose it is possible they did not remember correctly.
07-11-2007 08:13 AM
07-11-2007 09:02 AM
In LabVIEW, a ring is simply a numeric control which has a list of display strings. The strings and values in the control can be changed at any time since the control is a simple numeric.
An enum is a special numeric data type where the value includes both an integer and a string. The main advantage is when using case structures - wiring an enum to a case structure gives you the enum strings in the case structure, like this:
Changing the enum values after connecting it to the case structure will propogate accordingly. Wiring a ring control to a case structure is just like wiring any other numeric - you need to use numeric values.
The problem is that to set up enums you need to use the editing interface and that does not allow changing the values of the enum - they must be 0,1,2,3,4, etc. In my hacking I did manage to change the order of these, but not create a sparse one, and that's why I want the one from CVI. As I said, it is possible that this only applies to rings, but I was hoping it worked for enums as well. How do you place an enum into a control?
07-11-2007 09:40 AM
07-11-2007 01:32 PM
LabVIEW has three basic types -
I'm guessing the only way to import is using the process descibed there and explicitly refers to sparse enums, so I was hoping that would be simple, but I also see that the process says to use a ring control. I take it there is no other way to insert an enum into a control?
07-12-2007 03:56 AM
Looking at your description of a LabView enum it seems to have a correlation to a simple C string table, which can be defined like this:
char *strings [] = {"Zero", "One", "Two", "Three", "Four", "Five"};
n = 2;
Print (strings [n]); // Match the string to a numeric value
So this also gives a direct mapping of strings to sequential numeric values, where no gaps are allowed. With such a simple C primitive, CVI does not really need a specific GUI control to manipulate the resulting data.
JR
07-12-2007 06:53 AM
If my C understanding is correct, you can go back at any point in your code and change the array to hold other strings, so that's just a string array. An enum has constant strings and values as part of its data type, just like you can't set an int variable to be 3.6.
The LV enum is not necessarily limited to an ordered list. In my hacking I did manage to create an out of order enum ("three, one, zero, two"; 3, 1, 0, 2), but not one which includes numbers which are not sequential from 0. I was hoping this process would help.