LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reference to array element

Is it possible to access the contents of an array element without reading/writing the whole array?
I tried with the "Value" property of elements and it works, but it always affects the element in the last position i clicked. I don't know how to choose which element to access. SelStart[] and SelSize[] seem not to work.
0 Kudos
Message 1 of 9
(4,101 Views)
No it is not possible

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 9
(4,098 Views)
But i can read/write the last element i clicked... All i need to do is to select another element as if it was clicked. If it can be done with mouse there must be a way to select an element via program... What is that SelStart[] about?
0 Kudos
Message 3 of 9
(4,095 Views)

Hi

You could use the "Replace Array Subset" function located in the array palette.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 9
(4,088 Views)

Hi

You could use the "Replace Array Subset" function located in the array palette.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 9
(4,089 Views)
With some hocus-pocus you can get it done.

Here's how I did it:

  1. Set the number of visible array elements to 1
  2. Set the index (this automatically receives focus now since it's the only one displayed)
  3. Get the information you want from the property nodes (it will now point to the correct element)
  4. Re-set the array to how it was in the beginning (You did remember to save the initial state, right?  😉 )
It's ugly, but it works.

Try disabling panel updates before doing this, and re-enable them after and it doesn't look so bad.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 9
(4,081 Views)

Yes it works! And it's not too ugly if you plan to use the array only for storing data. I always keep visible elements to 1, and even hide the control.

I did some tests and for very large arrays (10000 or so) it's faster than Replace Array Subset (and the like). But it's much slower for small arrays. Also, it doesn't seem to avoid race conditions as i had hoped, but this one has to be tested better.

Thanks

0 Kudos
Message 7 of 9
(4,066 Views)
The simplest way to read/write a certain position of an array is to use "Array subset" and "Replace array subset" functions . I have attached a simple example containing these LV functions.
 
I hope this will help you.
 
Bye
 
Fabio

Message Edited by Fabio_81 on 11-02-2006 03:46 AM

Fabio M.
NI
Principal Engineer
0 Kudos
Message 8 of 9
(4,035 Views)
I know Smiley Indifferent
The topic was not about being "simple" but about being efficient
0 Kudos
Message 9 of 9
(4,025 Views)