From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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 1d array at specific point in 2D array

Solved!
Go to solution

Hi,

 

I have a 2D array with alot of information and only want to replace some data at a specific point... see image:Schermafdruk 2014-08-26 09.53.17.png

 

When i use replace subset i can only replace one element at a specific row and column...

Best regards,

Thijs Boeree

0 Kudos
Message 1 of 8
(3,501 Views)

@ThijsBoeree wrote:

When i use replace subset i can only replace one element at a specific row and column...


So, use a loop. 😄

0 Kudos
Message 2 of 8
(3,496 Views)
Solution
Accepted by topic author ThijsBoeree

I think i allready got it... Without a loop!!

 

I use index array on the 2D array then i use replace array subset on the 1D array, here you can give an index and replace the 2D array again with the newly formed 1D array!

Message 3 of 8
(3,488 Views)

Hi Thijs,

 

yes, without a loop - but with a data copy in memory…

 

Programming such algorithms always has to consider more than just one parameter/side effect/limitation: computing speed, memory footprint, …

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,473 Views)

The correct solution is to change the small 1D array to a 2D array and use "replace array subset" with both indices wired.

 

It requires a 2D array such that the function know if it needs to replace going down or going right from the given index. It cannot deal with a 1D array directly, because the operation would be ambiguous.

0 Kudos
Message 5 of 8
(3,437 Views)
Solution
Accepted by topic author ThijsBoeree

@altenbach wrote:

The correct solution is to change the small 1D array to a 2D array and use "replace array subset" with both indices wired.


Here's what I had in mind.

 

(If you want to replace down the column instead, simply add a transpose after the build array node.)

 

 

Message 6 of 8
(3,429 Views)

@altenbach wrote:
(If you want to replace down the column instead, simply add a transpose after the build array node.)

 

Message 7 of 8
(3,421 Views)

Wow that's a much nicer approach!

 

Best regards,

Thijs

 

 

0 Kudos
Message 8 of 8
(3,384 Views)