LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

having difficulty cluster convert to array of enumeratorsHi I have difficulty conver

Hi I have difficulty converting a cluster of enumerators to array of enumerators, unlike unbundle and build_array vis that work.
So If I have a unknown number of enumerators, I cannot use unbundle and build_array vis as they are fixed for decided number.

I am using Labview 7.1. I am puzzled over its ability to convert.
so here's the attached.

Would appreciate your help.
thanks in advance
0 Kudos
Message 1 of 9
(3,299 Views)
at run time the number of elements in a cluster are fixed, so there is no need to programatically to determine the cluster size.  If they are of different sizes, you can not wire them together.  So I am not sure why you are asking the question you are.  Why do you think this behaviour is an issue?
as for the bad rating, I am sorry... I made a major typo, and in trying to select edit, I hit the rating instead.  I am sorry! 

Message Edited by Stradis on 09-02-2007 10:21 PM


Paul
0 Kudos
Message 2 of 9
(3,299 Views)
hi It seems that you don't get my point. What I am trying to say, is to compare a set of unbundle and build array vis to Cluster to Array vi.
If I remove this set and wire using cluster to array vi, It cannot wire. Get my point?





Clement
Message 3 of 9
(3,292 Views)
OK, it seems the problem is the conversion to enum.  If you insert a "to u16" from the numeric palette in front of the cluster to array function, it will work fine.

Paul
Message 4 of 9
(3,288 Views)
Hi Stradis,
Thanks alot. I am surprised that we need to use interger converter.
I do not understand as I have checked that all the enumerators inside cluster box are unsigned word interger.
And the error dialog did not indicate clearly.
Anyway  thanks again
Pls forgive my crude reply I am irriated by your annoying reply.
Sorry

regards,
Clement
Message 5 of 9
(3,285 Views)
The problem you are having is that your enumerated data elements are not the same.  Enumerated data types include the string value,  So, since you have moved None around in the list and taken away a value from each, LabVIEW doesn't consider the data types to be the same.

I have attached three VIs showing options.

The first uses the same enum type for all the values.  The issue here is that the value of None doesn't change.  But, you can also convert this into your array of enums instead of U16s.  Please note that if you went this route, you should probably use a type def so if you ever had to add an 8, you'd do it once.  Not knowing your ultimate goal, it is difficult to suggest a method, although I would use the last example.

In the second, I changed your enums to rings.  The rings don't care what the string values are, so you can keep the different pull down lists as you had them in your original.

The third uses the different enums you have and uses a typecast to a U16 array.

The second and third examples lose its data meaning because you basically need to know how the values track back to the original data type.  The first keeps the data type.  But again, it may be beneficial in your case to have the values change based on which value is set ot None.

Matthew



Message Edited by Matthew Kelton on 09-02-2007 10:49 PM

Message 6 of 9
(3,277 Views)
If all of the members of the cluster are the same datatype, then you can use the Cluster to Array. However, it appears from your image, that there is some coercion dots on the Build Array function so that would imply different datatypes. Best to attach the actual VI.
Message 7 of 9
(3,274 Views)
Hi Matthews and Dennis.
Thanks for your helpful tips and advice.

Clement

0 Kudos
Message 8 of 9
(3,266 Views)
This VIs I posted were 8.2.1.  Here they are in 7.1
.

Matthew
Message 9 of 9
(3,258 Views)