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.
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.
06-19-2019 05:06 AM
I want to get the reference of element in array. But I only to get the first element reference.
How can I get the reference of element in array I want
06-19-2019 05:59 AM
06-24-2019 03:59 AM
@ziziran wrote:
I want to get the reference of element in array. But I only to get the first element reference.
How can I get the reference of element in array I want
In other words, you can't.
You can of course change the values of the individual elements, but not by reference.
06-24-2019 07:30 AM
There is probably an easier way to do what you want to accomplish. But since you asked:
The attached example (LV16) shows how to read/write elements in an array of clusters by reference.
The bad part is that the reference changes based on the value of "Index Values" property.
So you can't just get a reference and save it. You have to set Index Values each time you
need to use the reference.
steve
06-24-2019 08:54 AM
You can get the value of the entire array by reference, replace one element, then set the value of the entire array by reference.
But that's not what you asked, so it's basically the wrong question.
To do this on an array, it's going to depend a lot on the details and purposes. If you make the reference typed, you probably don't have to deal with variants. This is also the case with clusters, btw.
06-24-2019 09:03 AM
@stevem181 wrote:
There is probably an easier way to do what you want to accomplish. But since you asked:
The attached example (LV16) shows how to read/write elements in an array of clusters by reference.
That does seem to work. Not sure if it's supposed to be, or that it's coincidentally working.
Might have forgotten the trick, as it is higly impractical to work like that.
06-24-2019 06:38 PM
Agree with all the replies here. The array container is a method to contain a series of the same datatype in sequencial order. A method to hold values in memory.
It is not meant to be a Front Panel GUI object, to provide for accessing a particular value in a selection of values. This is why the array does not have these properties. There are other ways to do this using the Front Panel objects.