NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Jaspal
Posts: 48
0 Kudos
Accepted Solution

bundle by name and not just bundle

Hi all,

 

I have just got myself used to clusters, wires and shift registers intead of using local variables :smileyhappy:

I have a simple question which may sound too simple!!

I am using a lot of arrays and want to use bundle/unbundle by name as opposed to just bundle/unbundle for obvious reasons.

But Since I using constant to initialise arrays it has no name and hence cannot use the bundle by name.

 

Is there a way around this? (I am sure there is!)

Start and end of code images attached.

 

 

Trusted Enthusiast
TCPlomp
Posts: 3,097

Re: bundle by name and not just bundle

Right click on any of the constants (in) and select 'Visible->Label', by assigning a label you can alter the name of the cluster element.

 

 

 

Ton

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Knight of NI
johnsold
Posts: 10,171

Re: bundle by name and not just bundle

Consider a slightly different approach: Create a control (or indicator) from your cluster.  Make it a typedef. Create unique labels for each of the controls in the cluster. Create a subVI with only the cluster indicator on it.  Connect the indicator to the connector pane of the subVI.  Set the initial values for all the elements of the cluster in the subVI, Make Current Values Default, then save the subVI.  Place this subVI on the main VI connected to initialize the shift register.

 

Advantages: 1. By being a typedef any changes you make to the cluster automatically propagate throughout your program.

2. The subVI can be given a small icon to occupy very little block diagram space.

3. The cluster control does not need to be on the front panel.

4. Initial values can be set in the subVI and the documentation of the subVI can reflect those, if appropriate.

5. As you noted in your post, named controls allow the use of Unbundle and Bundle by Name to document the elements used at any point in the program.

 

Side note: Your images show nested sequence structures.  These constrain dataflow and can be hard to extend or modify as your program grows.   Look at the state machine architecture.  It may give you a more robust, maintainable and expandable program structure.

 

Lynn