LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build cluster array function

Solved!
Go to solution

Why is it that different data types can feed a bundle, but the Build Cluster Array function only accepts a single type?

 

jvh 

0 Kudos
Message 1 of 7
(2,830 Views)
Solution
Accepted by topic author jvh75021
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. In other words, you can't, for example wire an integer to the first input and a string to the second input since this would create a cluster of an integer, and a cluster of a string, which are two different datatypes, and you cannot placed these into an array simultaneously.
Message 2 of 7
(2,827 Views)

 

array has a single data type, which means all elements are of the same type.

 

cluster supports multiple data types bundled within the cluster

Message 3 of 7
(2,803 Views)

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? 

 

0 Kudos
Message 4 of 7
(2,776 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 7
(2,773 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 6 of 7
(2,770 Views)

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. 

Message 7 of 7
(2,763 Views)