LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare and replace values in 2D-Array

Hi

I have a 2D array and a 1D array as shown in the figure below. I need to replace zeros in the 2D array with NaN depending on the values in the 1D array.

For example since the first element in the 1D array is one, I need to keep the first element in the first row of 2D array and make the remaining zeros in the row as NaN.

Similarly the last row of the 1D array is three. So the zero in the last row of the 2D array remains as zero.

Any help to sort this out is highly appreciated.

Thanks 

0 Kudos
Message 1 of 2
(1,888 Views)

Use the auto indexing feature of For loop to get the row of 2D array and element of 1d array then you can try manipulating array element using node "Replace Subset array".

0 Kudos
Message 2 of 2
(1,860 Views)