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.

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,027 Views)
Solution
Accepted by topic author 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
(2,986 Views)

Hi  StevenD,

 

Thank you so much for your prompt reply. 

 

Gu

0 Kudos
Message 3 of 5
(2,975 Views)
Solution
Accepted by topic author 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
(2,964 Views)

Hi mcduff,

 

Thanks a lot. 

Gu

0 Kudos
Message 5 of 5
(2,849 Views)