LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array creation and usage - part 2

Solved!
Go to solution

Now I have an array. Is there a way pull out a single element modify it and replace it? Multiple elements? 

 

 

thanks 

0 Kudos
Message 1 of 16
(4,457 Views)
0 Kudos
Message 2 of 16
(4,453 Views)

jvh75021 wrote:

Now I have an array. Is there a way pull out a single element modify it and replace it? Multiple elements? 

 


http://www.google.com/search?&q=arrays+in+labview

 

Andrey.

 

0 Kudos
Message 3 of 16
(4,447 Views)
Thanks but Replace Array Subset does not like having the output tied back to the input array.
0 Kudos
Message 4 of 16
(4,444 Views)
Solution
Accepted by topic author jvh75021

Hi jvh75021:

 

Now that you have an array, you can perform several operations on it:

 

1.- You can pull out a single element by using Index Array.

2.- After you pulled out the element, you can modify it without problems.

3.- You can replace it using Replay Array Subset.

 

If you want to pull out contiguos elements in an array, you can use Array Subset.

If the elements are not contiguos, you can use Index Array in a loop.

 

You can find all the Array functions in the Functions Pallete>Programming>Array.

 

 

Luis Guizar
Message 5 of 16
(4,443 Views)

jvh75021 wrote:
Thanks but Replace Array Subset does not like having the output tied back to the input array.

And you can't. If the source array is a control then you can write it back to itself using a local variable or a property node. If it's a wire (such as the output of a VI or a function, then you can't do that. You would need to create an indicator to see the new array. 

Message 6 of 16
(4,438 Views)

Excellent. The first result, 

 

http://cnx.org/content/m14768/latest/  ,

 

has some excellent videos. 

0 Kudos
Message 7 of 16
(4,437 Views)

Thanks, just wasn't looking for the right keywords. I was thinking read, write, etc. 

0 Kudos
Message 8 of 16
(4,433 Views)

Just for completeness don't forget about the example finder. If you type arrays on the index tab you will come up with examples such as 'Build Arrays.vi' and 'How to Replace Elements in an Array.vi' and so many more. Remember that context help and highlight execution mode will help greatly in understanding how these work.

 

Hope this helps.

Now Using LabVIEW 2019SP1 and TestStand 2019
Message 9 of 16
(4,411 Views)

I'm surprised nobody mentioned the In Place Element Structure yet...it lets you modify the array element without making any extra copies:

 

InplaceElementStructure.png

Message 10 of 16
(4,396 Views)