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

@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 GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 2 of 8
(1,828 Views)
Solution
Accepted by 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
(1,820 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 LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 8
(1,805 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.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 5 of 8
(1,769 Views)
Solution
Accepted by 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.)

 

 


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

@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 GCentral
What does "Engineering Redefined" mean??
Message 7 of 8
(1,753 Views)

Wow that's a much nicer approach!

 

Best regards,

Thijs

 

 

0 Kudos
Message 8 of 8
(1,716 Views)