Showing results for 
Search instead for 
Did you mean: 

Unbundle by Name

For debug purpose I am using "Unbundle by Name" to unbundle elements of a cluster to a 2D array and then writing that data to a spreadsheet file. As I go through the debug process, the channels of interest might vary causing  me to change which elements are being unbundled. I would like to programmatically read the names of the elements being unbundled  so I can include them in the spreadsheet file as column headers.


Is there a way to do this?




0 Kudos
Message 1 of 4

I have done something similar where I cast the data to a variant and then use the type information primitives to get the names. You can get this to work recursively, too, for clusters in clusters etc. VI scripting might also work for you, where you query the attributes of the unbundle function itself. I guess that there are better solutions though.


Depending on your debugging restrictions, you might get away with just dumping the whole thing into a json or xml file and do the selection on the receiving end. Or use an xml object as an intermediary from which to select the control and column header in one go. In more recent LabVIEW versions, a map may also prove helpful, however I cannot comment on them.

Message 2 of 4

If this is for debugging and you don't need a super dynamic/robust solution, I would probably just feed the cluster and an enum (enum identifies cluster members) into a SubVI and output the requested item as a string. It's not really reusable as it's tied to a specific type of cluster but I would only go the data parsing route if it was the only option. In the functions palette these functions are under Programming > Cluster, Class, & Variant > Variant > Data Parsing.

Matt J | National Instruments | CLA
Message 3 of 4

All you have to do is wire the output of each unbundled element into one of these guys:



This palette contains a lot of other things as well, and they may be even more useful to you than this one.

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 4