10-01-2009 05:43 AM
Hi all,
I have just got myself used to clusters, wires and shift registers intead of using local variables 🙂
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.
Solved! Go to Solution.
10-01-2009 06:11 AM
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
10-01-2009 07:37 AM
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