03-17-2010 05:27 PM
Why is it that different data types can feed a bundle, but the Build Cluster Array function only accepts a single type?
jvh
Solved! Go to Solution.
03-17-2010 05:36 PM
03-17-2010 09:39 PM
array has a single data type, which means all elements are of the same type.
cluster supports multiple data types bundled within the cluster
03-18-2010 08:17 AM
smercurio_fc wrote:
Basically because it doesn't do what I think you think it does. As the documentation indicates, each component is placed into a cluster. That cluster is always one element, and the cluster is placed into an array. Since each element of an array has to be of the same datatype, this means that each input to that function has to be of the same type so the cluster datatype is the same.
What you are saying here sounds like a cluster can only have one data type in it. But clusters can have elements of different data types and these clusters can be contained in an array. Right? Or am I wrong as usual?
What would be the practical use of this function?
03-18-2010 08:23 AM
jvh75021 wrote:
smercurio_fc wrote:
Basically because it doesn't do what I think you think it does. As the documentation indicates, each component is placed into a cluster. That cluster is always one element, and the cluster is placed into an array. Since each element of an array has to be of the same datatype, this means that each input to that function has to be of the same type so the cluster datatype is the same.What you are saying here sounds like a cluster can only have one data type in it. But clusters can have elements of different data types and these clusters can be contained in an array. Right? Or am I wrong as usual?What would be the practical use of this function?
That function is good for convert flat cluster of the same data type to an array.
Anything more complex would require some guessing that would probably be wrong for most cases.
Ben
03-18-2010 08:29 AM
There is one "famos" example for a situation where this comes handy:
Controlling a standard state machine using a collection of buttons. Since an array is scalable and easily used for checking "which button was pressed", it has one severe backdraft making it impossible to use on the interface: All elements in the array share every attribute with one exception: the value. So you cannot have an array of buttons on the interface which have different boolean texts (since this is apparently not the value of the button). So you would use a cluster of buttons and in the blockdiagram cast it inot an array since you are only interested on the button-ID (so the index) which was pressed, not in a boolean text or similar.
hope this helps,
Norbert
03-18-2010 08:53 AM
jvh75021 wrote:
smercurio_fc wrote:
Basically because it doesn't do what I think you think it does. As the documentation indicates, each component is placed into a cluster. That cluster is always one element, and the cluster is placed into an array. Since each element of an array has to be of the same datatype, this means that each input to that function has to be of the same type so the cluster datatype is the same.What you are saying here sounds like a cluster can only have one data type in it. But clusters can have elements of different data types and these clusters can be contained in an array. Right? Or am I wrong as usual?What would be the practical use of this function?
I'm not saying that at all. - that's what you're interpreting. What I'm saying is what the function is doing, not what a cluster is capable of holding. Ben and Norbert have given a couple of examples on when this can be used. It's of limited use, practically speaking. I think I've used it maybe twice since it was introduced.