11-24-2017 09:05 AM
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
Solved! Go to Solution.
11-24-2017 10:04 AM
Adding to a cluster requires dragging the new data type into the cluster.
What have you tried? What isn't working?
11-24-2017 10:08 AM
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/
11-24-2017 10:24 AM
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.
11-24-2017 10:26 AM
Thanks Blokk.
That's really what I was asking. How do I modify the existing cluster?
11-24-2017 10:48 AM
Read my comments in the VI!
11-24-2017 11:05 AM
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
11-24-2017 11:19 AM
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!
11-24-2017 11:32 AM
That is fantastic. Thank you for all your help.
Andrew