From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Renaming elements within a cluster

Hi, I'm using the "index and bundle cluster array" in which I want to create a cluster of both of my arrays (Horizontal & Vertical). The problem is that after using this function the arrays don't retain their original names(labels) as can be seen in the attachment. Is there something that should be done in order to make them?  I'm totally missing something, any help is appreciated. 

 

A.

 

0 Kudos
Message 1 of 6
(3,285 Views)

It is much easier for us to help you if you attach code (meaning files with the extension .vi) instead of pictures of code.

 

You have created a cluster, but one whose components are "anonymous", unnamed, only typed.  If you have a cluster that has been defined by either being created (with named elements) or has a Type Definition ("TypeDef". having the extension .ctl), you can use the much-more-useful "Bundle by Name" (and, similarly, "Unbundle by Name").  There are only rare instances where "Bundle" and "Unbundle" (the "anonymous" versions) should be used.

 

Bob Schor

0 Kudos
Message 2 of 6
(3,235 Views)

Alright I just thought that it'll be messy since it a big code. by the way the bundle by name didn't work. 

 

My goal: this vi draws with mouse movement and sends this to a Gcode interpreter, I want to add a more reliable movement (using the arrow keys) in which I created  that code that I showed you. So I want to connect both of my inputs to the same graph but to get things right the x and y should be in a cluster and named Vertical & Horizontal.

If anymore info is needed just let me know, thanks.

PS: the code is in the lower right of the "Main" VI

A.

 

0 Kudos
Message 3 of 6
(3,230 Views)

This is what I was talking about.  Note that this image is actually a LabVIEW Snippet:  if you open a LabVIEW 2016 blank VI, you can drag this image into the Block Diagram and it will automagically expand into working LabVIEW code.Cluster Demo.png

The Control "Point" is a LabVIEW Cluster I created with Dbl elements called Horizontal and Vertical.  What you should do is right-click this control, choose Make Type Def, then open the TypeDef and save it as a named Control (I suggest using the name "Point").  Now you can use the TypeDef as a constant instead of needing a Control that basically "does nothing" (except define the Cluster) on the Front Panel.

     The first loop shows building an array of Points, each with a random Horizontal and Vertical element, and creating an Array of Points.  The second loop takes this array apart, "re-packaging" all of the Horizontal elements into an X Array, all the vertical elements into a Y Array.

     I'm surprised you didn't understand this.  I gather you have not taken the time to view the LabVIEW Basics tutorials mentioned at the top of this Forum.  I recommend you spend your time learning the basics.

 

Bob Schor

0 Kudos
Message 4 of 6
(3,180 Views)

If you do not want to use the bundle by name and build an array then another option is to type cast the wire to an array of clusters with each cluster element named.

 

But that is more cryptic that build an array of clusters with proper names.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(3,143 Views)

@AHmedalnahdi wrote:

Hi, I'm using the "index and bundle cluster array" in which I want to create a cluster of both of my arrays (Horizontal & Vertical). The problem is that after using this function the arrays don't retain their original names(labels) as can be seen in the attachment.


Nope, that can't be seen in your attachment. What ever label you have on the wires on the left side (outside the picture) is their active name. What you call the indicator they connect to has no bearing on it.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(3,114 Views)