LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add an element to an existing cluster. I thought it would be easy!

Solved!
Go to solution

Hi all. I have inherited a sub vi and need to add an element to an existing cluster of 8 elements. I have looked at all the examples I can find but can't figure it out. Firstly I don't understand why the front panel has names on the indicators, Respiration, Pulse, Sync and yet the Bundle by name function has "Data channel 1" etc.

I need to add an indicator with an array of 4 byte numbers called "Time" and add that, to make a cluster of 9 elements. I thought it should be relatively simple but I'm stumped.

Thanks for any advice.

Andrew

 

0 Kudos
Message 1 of 9
(7,418 Views)

Adding to a cluster requires dragging the new data type into the cluster.

 

What have you tried?  What isn't working?

0 Kudos
Message 2 of 9
(7,392 Views)

The previous programmer did not know one of the most important rule in LabVIEW: make your cluster TYPE DEFINED!

You need to create a new cluster (either from scratch or modifying the existing one), and save it as a type definition.

After that wherever you use this in your code, it is enough to modify the definition, and magic: the changes propagate through your whole project.

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/creating_type_defs/

0 Kudos
Message 3 of 9
(7,387 Views)

I have tried adding a new element to the Bundle by name function, but it just calls it Data channel 2. I've tried copying and pasting one of the array indicators and then changing the name to Time. I've looked for somewhere to rename the elements so they have their real names.

Basically, I need an extra indicator on the front panel and a corresponding element in the Bundle by Name function to make that 9 elements so I can wire the time out to the indicator.

0 Kudos
Message 4 of 9
(7,383 Views)

Thanks Blokk.

That's really what I was asking. How do I modify the existing cluster?

0 Kudos
Message 5 of 9
(7,380 Views)

Read my comments in the VI!

 

Parse PRS-1_mod.png

Download All
Message 6 of 9
(7,368 Views)

Wow, thanks Blokk. That is perfect. Just what I was trying to achieve. Please, would you mind explaining how you did that?

 

Thanks again.

Andrew

 

 

0 Kudos
Message 7 of 9
(7,362 Views)
Solution
Accepted by topic author ASH2020

Right click, make type def. Right click, open type def. Edit the cluster elements and order and data types.

Save type def as ctrl file. 

 

Do NOT forget to replace ALL instances of the old cluster everywhere in your project with the t type def cluster!

0 Kudos
Message 8 of 9
(7,359 Views)

That is fantastic. Thank you for all your help.

Andrew

 

0 Kudos
Message 9 of 9
(7,355 Views)