LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting elements of an array using property nodes

I would like to know how I can access an array not by using the usual
'Index Array VI' but by using property nodes. I created an array with
a digital indicator and from this control a property node wich I set
to Selection size[], Selection start[] and Value (Selsize[],
selstart[], value). Changing the properties Selsize[] and selstart[]
does not result in a visible change of the active element and changing
the value property is not resulting in a change of the value of the
active element.

The reason of doing it this way is that I want to access elements of
array that is referenced by the controls[] property of another control
(cluster).

Johan
0 Kudos
Message 1 of 35
(14,135 Views)
Johan,

Not sure what you are doing, but in order to get array elements by using the properties of your cluster, I would suggest that you 'translate' the property of the cluster into the index of the array you are looking at, and retrieve the data that way.
0 Kudos
Message 2 of 35
(14,122 Views)
The Array element value returns the cell value which you select/click on. I tried to set key focus to the value i wanted, instead of manually clicking on the cell, but this didnt work. However, if you set the 'Index value', then you can change the Array element value, and as long as the array hasn't been clicked in, the active cell will be 0. See the attached example (in LV 6.0).

I also spent a little time looking at what the Selection start and Selection size do in the array property, and i couldn't work it out! It seemed to do nothing, and the help wasn't much use either. Maybe someone can enlighten us both here.

I hope this helps you..

Kim
Message 3 of 35
(13,813 Views)
Labviewguru wrote in message news:<506500000005000000309B0000-1027480788000@exchange.ni.com>...
> Johan,
>
> Not sure what you are doing, but in order to get array elements by
> using the properties of your cluster, I would suggest that you
> 'translate' the property of the cluster into the index of the array
> you are looking at, and retrieve the data that way.

I've put a document with an example of the problem at:

http://uttnb71.tn.utwente.nl/asp/labview.doc

or

http://uttnb71.tn.utwente.nl/asp/labview.pdf

I hope it will make it clear what I want to do.

Johan
0 Kudos
Message 4 of 35
(14,122 Views)
Go to my LabVIEW page at http://cybertechs.qc.ca/~jpdrolet/labview and download the Cliked Array Element example. It shows how I used this feature to detect on which array element the user clicks. It also uses the selection feature. To see what Selection Start and Selection Size do, you must enable "Show Selection" in the advanced menu of the array. The selected elements are highlighted in blue.

Remember that property nodes purpose is mainly to manipulate controls appearance and behavior rather than data. You can read/write a control using the value property but it is not the preferred way and is less efficient.


LabVIEW, C'est LabVIEW

Message 5 of 35
(13,813 Views)
Johan,

I am clear as to what you want to do, but I am not sure why.

Is there a reason you just can't access the entire array from the reference, obtain the value (the entire array) and then index the element that you want?
0 Kudos
Message 6 of 35
(14,122 Views)
Labviewguru wrote in message news:<506500000005000000979B0000-1027480788000@exchange.ni.com>...
> Johan,
>
> I am clear as to what you want to do, but I am not sure why.
>
> Is there a reason you just can't access the entire array from the
> reference, obtain the value (the entire array) and then index the
> element that you want?

The bad thing is that the value you obtain is not an array but a
variant containing array data. You simply do not know what kind of
data is inside the array otherwise it could be strictly referenced

Johan
0 Kudos
Message 7 of 35
(14,122 Views)
"Jean-Pierre Drolet" wrote in message
news:506500000005000000729B0000-1027480788000@exchange.ni.com...
> Go to my LabVIEW page at http://cybertechs.qc.ca/~jpdrolet/labview and
> download the Cliked Array Element example. It shows how I used this
> feature to detect on which array element the user clicks. It also uses
> the selection feature. To see what Selection Start and Selection Size
> do, you must enable "Show Selection" in the advanced menu of the
> array. The selected elements are highlighted in blue.
>
> Remember that property nodes purpose is mainly to manipulate controls
> appearance and behavior rather than data. You can read/write a control
> using the value property but it is not the preferred way and is less
> efficient.

Je
an -Pierre,

I think I misunderstood the meaning of selection Start en selection size. I
thought it was way of making a particular element of an array active so that
you can read its value, but it appears not to be like that. With your
technique you can of course find out what the position of the element in the
array is and get its value with the arrayelement.value property but that is
only because you clicked on it. I want to read the value without clicking
the actual element.
Just plain giving a value to certain properties for selecting the element
and then reading its value.
0 Kudos
Message 8 of 35
(13,813 Views)
Johan,

if the variant array is your problem then you can take a look at the lvdata package of the OpenG Toolkit at http://sf.net/projects/opengtoolkit . It depends on the error package so download both lvdata and error packages.

The LabVIEW Data Tools contains numerous VIs to manipulate variant data. You can use "Index Array.vi" that inputs a variant array and an array of indices and outputs the array element (as a variant too). The toolset is still under active development so your feedback is appreciated for any feature that you would need and that is missing. While writing this I realize the the toolset lacks a "Replace Array Element.vi" for arrays...

On the other hand, if the array has always the same nuber o
f dimensions (1D, 2D,...) you can use the "To G Data" function to convert a variant array to an array of variant data. After the conversion you get an array of variants that you can manipulate like any other array to index and replace elements.


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 35
(14,122 Views)
Johan,

Here is a VI illustrating two ways to manipulate array data by reference. With both ways the whole array is read,modified and written back by value property. As you have seen, this is hardly done using the array element reference since it is a reference to a control not tied to a specific element but to the array element the user is currently editing.


LabVIEW, C'est LabVIEW

0 Kudos
Message 10 of 35
(13,813 Views)