11-01-2010 02:00 PM
I want to do this for the an entire array of clusters. I'm trying to use a for loop. Can't figure out how to parse the string portion of the enum into the string portion of the cluster.
Alternatively, I'd be happy if I could figure out some way to tie the enum to the array of clusters, but I figure that gets problematic.
DH
Solved! Go to Solution.
11-01-2010 02:04 PM
format into string
11-01-2010 02:52 PM
OK, let's say that the enumerated type has N elements. I want to initialize an N element array of strings. How do I reference each string in the enumerated type to get to each string?
DH
11-01-2010 03:01 PM
Use the "Strings[ ]" property node on the enum to get an array of strings of the elements.
11-01-2010 03:06 PM - edited 11-01-2010 03:11 PM
@Dark Hollow wrote:
OK, let's say that the enumerated type has N elements. I want to initialize an N element array of strings. How do I reference each string in the enumerated type to get to each string?
Easy way to do this is to use GetNumericInfo.vi, part of the Variant library, found in vi.lib\utility\VariantDataType\GetNumericInfo.vi. Wire your enumeration to the Variant input; one of the outputs is an array of the strings in the enumerated type.
The more complicated way is a for loop, in which you typecast the iterator terminal value to the enumerated type, then use Format Value. You can get the maximum value of the enumeration by casting 0 to the enumerated type, then decrementing; cast that back to a numeric and add one to get the right value to wire to the N terminal.
EDIT: just thought I'd add, since RavensFan's reply popped up while I was writing mine - I don't like the Strings[] approach because it doesn't work on RT targets, and I lost a lot of time once due to this trying to figure out why my code wouldn't run properly on an RT system but worked great on my development computer.