LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

easily rename a variable

I am bundling variables and then passing them through a flat sequence. I am them unbundling them by name. The whole reason for bundling them and then later unbundling by name is to make it easy to keep track of which wire is what. The problem I've got is that I can't figure out a simple way to assign the variables the names I would like them to have at or near the point where I bundle them. I know that I can connect a cluster constant to the input cluster connector of the bundle by name function, and then populate that cluster constant with a giant array of labeled constants but this would take up half the screen. I also considered shooting the variables into a line of subvis that do nothing more than force name assignments, but this is also ungainly and just seems plain silly. so, what's the easy way? -thanks

global variables make robots angry


0 Kudos
Message 1 of 6
(4,450 Views)
The Bundle By Name requires that you wire an input cluster so that is knows which element of the cluster that you're replacing. The Bundle function does not. The output cluster of the Bundle function will have the individual element names based on what was put it. These get picked up by the Unbundle By Name function. The problem you run into is when you have wires that were generate by, say, a function, like this example:



In this case the Unbundle By Name only has "Numeric", "Boolean", and "String" as selections, since the wire that is the output of the Add function has no name. Unfortunately, there's no "simple" mechanism for "naming" an internal wire like that. You can do this:



However, that's a bit clumsy.

You can also just place a regular label, like this:




Message Edited by smercurio_fc on 05-08-2008 05:57 PM
Download All
Message 2 of 6
(4,437 Views)
Thanks. I have provided a document to my programming group that explains how to label wires going into a bundle. You have been immortalized in the document as I have credited you with the provided method.
 


Message Edited by Root Canal on 05-09-2008 11:29 AM

global variables make robots angry


Message 3 of 6
(4,403 Views)

Hi Root,

When it comes to clusters you often find yourself passing clusters to sub-VI's and when the clusters get updated, the sub-VI calls will break unless you use Type Definitions. I wrote a Nugget on Type-defs that can be found here.

Please forgive me if you already knew this!

Just trying to help,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 6
(4,395 Views)
Thanks, ben. I think I'll encourage the use of type definitions for larger projects.

global variables make robots angry


0 Kudos
Message 5 of 6
(4,380 Views)
Hi Canal,
I think it doesn't depend on the size of your project, whether you use typedefs or not. It's not much work to create them, and they make things safer.
I made an example how to use the bundle/unbundle nodes (despite I think you know that), so that the name of the variables (better terminals or cluster items) are not lost.



Greets, Dave


Message Edited by daveTW on 05-09-2008 11:13 PM
Greets, Dave
0 Kudos
Message 6 of 6
(4,352 Views)