# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## replace 1d array at specific point in 2D array

Hi,

I have a 2D array with alot of information and only want to replace some data at a specific point... see image:

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

Best regards,

Thijs Boeree

Message 1 of 8
(1,782 Views)

## Re: replace 1d array at specific point in 2D array

@ThijsBoeree wrote:

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

So, use a loop. 😄

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 2 of 8
(1,777 Views)
Solution
Accepted by topic author ThijsBoeree

## Re: replace 1d array at specific point in 2D array

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
(1,769 Views)

## Re: replace 1d array at specific point in 2D array

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 LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 4 of 8
(1,754 Views)

## Re: replace 1d array at specific point in 2D array

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.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 5 of 8
(1,718 Views)
Solution
Accepted by topic author ThijsBoeree

## Re: replace 1d array at specific point in 2D array

@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.)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 6 of 8
(1,710 Views)

## Re: replace 1d array at specific point in 2D array

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

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 7 of 8
(1,702 Views)

## Re: replace 1d array at specific point in 2D array

Wow that's a much nicer approach!

Best regards,

Thijs

Message 8 of 8
(1,665 Views)