Wednesday, August 18, 2010

Programming LabView - Clusters Part 2

Below is the block diagram with a terminal for the newly added cluster. Note that clusters are purple (and can also be brown) in some cases. Also shown is the menu for cluster functions with "Unbundle" about to be selected.

Below is another menu option "Unbundle by Name". These functions are similar, but unbundle by name is preferred by most experienced LabView programmers. You will see why shortly.

Below is a picture of the block diagram with the Unbundle (top) and Bundle (bottom) functions newly wired to the cluster terminal. You see that only the type of the data, in order, is shown with the unbundle, while the name from the front panel is shown with each piece of data for the Unbundle by Name function. This will be much less confusing as you develop programs using clusters. However, not all the data is shown. You can select which data you want, or expand to multiple unbundle by name terminals.
After clicking on the bottom edge of the unbundle by name icon and dragging down, terminals have appeared for all the pieces of data in the cluster:
Now navigate to the cluster menu and drop the "Bundle by Name" function on the block diagram and wire it as shown below. From the rightmost terminal of the "Bundle by Name" icon, right click and use the context menu to "Create Indicator".

The wire from the cluster contains all the pieces of data for the three controls. The Bundle by Name is allowing you to keep the values of the other data the same while changing the value of the "Numeric" control. However, the code is broken. Right click on the bundle input and "Create Control":

After rearranging some of the controls and indicators on the front panel, it now looks like this:

Note that you can type anything you want into the control cluster. The code leaves the String and Boolean unchanged while overriding the value of Numeric in the cluster with the alternate value (shown as 4 above). The indicator is downstream in the dataflow from the bundle by name function, so it now contains 4 for its numeric value.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers