LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i assign or modify a control refnum (in hex) value on each element of an array to make each element unique by reference?

Hi,

 

I have an array of clusters that i'm indexing using array refnum, ArrElem and IndexVals to obtain each element and process it as a Cluster in a different loop. The problem that i have is that every time that a new array element is indexed, it will overwrite the previous one because is the same refnum.

 

I'm attaching a simpler VI that is doing the same process but with an array of strings (which is the same case is terms of references).

 

Question:

How can i assign or modify a control refnum (in hex) value on each element of an array to make each element unique by reference?

 

Thank you in advance,

 

Note 1: If it is possible to do this within Labview, that will be perfect, but i have spent already several days trying to find how to do this, and it seems that I will need to use an external language or go deep into the labview configuration to do this.

 

Note 2: This is a very very very simple example of a very very very huge project for which i'm creating a generic indexing (because i don't know what will be my array), so what i need is to have each element of the array with its unique reference so that i can process each element at anytime later.

 

Before

JATB_0-1681443395859.png

 

After

JATB_1-1681443457391.png

 

0 Kudos
Message 1 of 6
(1,283 Views)

Hi, 

why don't you use the array functions instead of reference, it seems the property you are trying to use is not settable when vi is running?


bharathp10_0-1681450632405.png

 

 

bp
0 Kudos
Message 2 of 6
(1,253 Views)

What are you really trying to achieve here?

If you want an array of 'anything', either make it an array of Variants, or of classes. It'll require (quite) some outside code for handling, probably, but that's the nature of the beast. If you want some functions that work on any type of array, just make it a Malleable VI (it can't be dynamically anything with them, but at coding/compile time)

So, what are you trying to achieve?

 

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

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

@JATB wrote:

Question:

How can i assign or modify a control refnum (in hex) value on each element of an array to make each element unique by reference?


If that would work, it would work like this:

 

wiebeCARYA_0-1681457932433.png

Note that values are not 'hex' or 'decimal'. Hex or decimal are how you visualize the values, it doesn't change the value.

 

You basically don't want to work with arrays like that.

 

Array indices don't have references that work like that. The properties of index would change all other indices's properties, as there is just 1 type in the array (all values are the same). It doesn't serve any purpose to do this.

In stead, use values and indices:

 

wiebeCARYA_0-1681458447740.png

 

Message 4 of 6
(1,230 Views)

The array element reference refers to one array element; and you don't get to pick which one.  Usually it's the last one that had text focus.

0 Kudos
Message 5 of 6
(1,202 Views)

Sometimes this works, but it doesn't seem to be reliable.

0 Kudos
Message 6 of 6
(1,199 Views)