From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Using comparison function where 2 arrays of different data type

Solved!
Go to solution

Is there a way to use the comparison function in Labview where you're comparing 2 arrays of different data types (e.g. boolean and double precision)?  

0 Kudos
Message 1 of 7
(2,850 Views)

How would you define the result?

 

Are the arrays the same size?

 

Please tell us what you really want to do. As you have probably already discovered, you cannot wire two different types of arrays to the comparison functions.

 

Lynn

0 Kudos
Message 2 of 7
(2,846 Views)

You could use the function Bool to (0,1) and compare it to the double precision.  It will be true any time the double precision number is either 0 or 1.

0 Kudos
Message 3 of 7
(2,845 Views)

The arrays are the same size and 2 dimension.  The object is to import a 2-d of numerical values into an array and use an array of boolean to select the number in the array. Thus, I need to accomplish the following steps.

 

1. read a spreadsheet of columns and rows of numbers.

2. create a 2-d boolean array.

3. select the element of interest in the boolean array that corresponds the element in numerical array.

4. identify the index (i,j) in the numerical array that I need to subsequently need to call the element for downstream math operations.

 

 

0 Kudos
Message 4 of 7
(2,834 Views)
Solution
Accepted by topic author tensegrityguy

Would this work?  Nested FOR loops to index out the TRUE values of the Boolean array.

0 Kudos
Message 5 of 7
(2,826 Views)
Solution
Accepted by topic author tensegrityguy

Good. You have a fairly clear definition of what you want to do.

 

For item 1 a function exists to do exactly that, provided the spreadsheet format is compatible.

2. How is this array to be created? Is this for user entry, read from another spreadsheet, derived from physical measurements?

3. Will there always be exactly one true element in the boolean array or are other combinations possible?

4. The 4th requirement seems to imply that the answer to 3 is exactly one. If so, the search Search 1D array fucntion could be used with some additonal logic to get what you want.

 

What have you tried? Where are you having problems? Specifically, what does not work, what errors do you get, and so on?

 

Post your attempts along with some typical data and a clear explanation of the expected results for that data.

 

Lynn

 

 

0 Kudos
Message 6 of 7
(2,824 Views)

Thanks!!  

 

Great idea.

0 Kudos
Message 7 of 7
(2,817 Views)