LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace elements of an array from array of indices

Solved!
Go to solution

From a text spreadsheet of possible switch positions where options "on", "off", "either" exist with the values "0", "1", "2". I need to edit the resulting array to replace all the "2" values to be either "0" or "1". With the attached Array Testing.vi I am able to extract the spreadsheet into an array and then extract the indices of all the "2" values. I also generate an array of "0" and "1" to use for the edit.

 

I am having trouble understanding how to over-write the "2" values with the "0" or "1" from the randomly generated array while retaining the original array "0" and "1" data. 

 

The final array of 0's and 1's will be converted to a boolean array.

 

What say you? 

Download All
0 Kudos
Message 1 of 3
(1,074 Views)
Solution
Accepted by topic author andy.mcleod@unh.edu

andy.mcleod@unh.edu wrote:

I am having trouble understanding how to over-write the "2" values with the "0" or "1" from the randomly generated array while retaining the original array "0" and "1" data.


Use a Select function.  If the value is 2, use the new value.  If not, use the old value.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(1,050 Views)

Simple and easy to implement. Thank you!

0 Kudos
Message 3 of 3
(1,040 Views)