LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

grouping clusters

Hi,

 

I have a very basic question. I have been using labview with years, but very rarely use clusters. I want to combine cluster 1 and cluster 2, and then use unbundle by name to get any entry to either cluster 1 or cluster 2. The basic bundle will take the names of the first cluster but not the second cluster. How do I combine both clusters and keep all the names?

 

sn900_0-1612981780659.png

I am using the labview base edition

 

Thanks in advance

 

Michael

0 Kudos
Message 1 of 9
(346 Views)

Naming cluster elements is best done by wiring a cluster constant to the top to the bundle node. Make sure all elements have well defined labels.

 

You are creating a new cluster that contains two clusters. So here is an idea:

 

altenbach_0-1612982528643.png

 

Except for very simple cases, I strongly recommend to do all bundle operations "by name". If you rely on the incoming wire name, all bets are off. "By name" offers much better diagram readability and self-documentation of the code!

 

0 Kudos
Message 2 of 9
(339 Views)

Hi Michael,

 


@sn900 wrote:

How do I combine both clusters and keep all the names?


The last bundle will keep the names of elements in both sub-clusters…

 

When you want to use clusters with named elements you should think of typedefinitions and using BundleByName!

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 3 of 9
(332 Views)

Hi,

 

Thanks for your replies, its great to be able to get help, and so quickly too!

 

You can see in the bottom image, if you hover over the white box, the hand appears, and if you click, the list of names appear, and you can select the desired output.

 

But, if you click the white box with the pink line, no options appear. The names are not there. I have attached the vi also.

sn900_0-1612984150837.png

 

Your help is appreciated,

 

Michael

 

 

 

0 Kudos
Message 4 of 9
(307 Views)

Hi, I figured out why that wouldn't work. 

 

The two brown lines are two new clusters with the same name, and that won't work. If you assign them each a different name, it works fine.

 

Instead of forming a new pink line of two clusters, one with 2 elements, and one with 4 elements, is it possible to form a single cluster with 6 elements. It would be a bit like conjugate building of an array?

 

sn900_0-1612985791957.png

 

Thanks 

 

Michael

 

0 Kudos
Message 5 of 9
(302 Views)

Hi Michael,

 


@sn900 wrote:

Instead of forming a new pink line of two clusters, one with 2 elements, and one with 4 elements, is it possible to form a single cluster with 6 elements. It would be a bit like conjugate building of an array?


Use just one Bundle(ByName) node instead of those two individual ones on the left side of the code.

 

You cannot "build a bigger cluster from two smaller clusters" like you can do with arrays. Either use the larger cluster right from the beginning or unbundle the smaller clusters and bundle all elements into a bigger one…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 6 of 9
(298 Views)

@sn900 wrote:

Instead of forming a new pink line of two clusters, one with 2 elements, and one with 4 elements, is it possible to form a single cluster with 6 elements. It would be a bit like conjugate building of an array?


Clusters are fixed at run time. Typically you should decide on a good data structure from the beginning. Using "by name", you can easily update parts in different locations, e.g. as follows:

 

altenbach_0-1612986955576.png

 

0 Kudos
Message 7 of 9
(290 Views)

@sn900 wrote:

Instead of forming a new pink line of two clusters, one with 2 elements, and one with 4 elements, is it possible to form a single cluster with 6 elements. It would be a bit like conjugate building of an array?


Here's one possibility, but I would very strongly advise against it 😄

 

altenbach_0-1612987703957.png

 

0 Kudos
Message 8 of 9
(278 Views)

Thanks for your replies,

 

I will make sure to put all the constants into the first bundle. I will assign a special vi to build each bundle, then if I want to alter the bundle, I will only need to alter it in one vi.

 

Thanks

 

Michael

0 Kudos
Message 9 of 9
(236 Views)