LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace array subset

Solved!
Go to solution

Hi Friends,

 

 I wanted to use replace array subset in my  sample VI, replacing array A's second and third columns with array B. I tried 3 ways to do it, respectively as described below: I would like to know why the second and the third ways did not work?

 

1. Delete array A's second and third columns followed by inserting array B into the resulting array A, which worked as shown in output array 1.

2. Use a for loop with an index array followed by replacing array subset, it did not work properly, only the last column was replaced as shown in output array 2.

3. Transpose the array B and then use the transposed array as an index for the for loop, which also did not work,  only the last column was replaced as shown in output array 3. 

Here is the snapshot and the Vi attached. 

 

Thanks,

Gu

Array test_conbined.png

 

 

 

 

0 Kudos
Message 1 of 5
(3,313 Views)
Solution
Accepted by edmonton

You are not using shift registers on the "A" array. So basically the first iteration you are replacing the second column, but then discarding those changes the next iteration.

Message 2 of 5
(3,272 Views)

Hi  StevenD,

 

Thank you so much for your prompt reply. 

 

Gu

0 Kudos
Message 3 of 5
(3,261 Views)
Solution
Accepted by edmonton

This doesn't answer your question, which has already been answered, BUT, it greatly simplifies your code.

 

Snap18.png

All you need is ONE replace array subset; the other code is Rube-Goldberg like.

 

mcduff

Message 4 of 5
(3,250 Views)

Hi mcduff,

 

Thanks a lot. 

Gu

0 Kudos
Message 5 of 5
(3,135 Views)