LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Quick way to convert a 2D boolean array to a 2D number array

Hi,

 

I was wondering how I could convert a 2D boolean array to a 2D number array. I want to multiply the boolean array with another one, but I can't because the types are incompatible.

 

I tried converting to a digital and then a binary, but the binary gives me a 1D array for some reason.

 

Thanks.

0 Kudos
Message 1 of 10
(5,079 Views)

Can you show what you tried that didn't work?

 

What should the conversion look like?  Is it a case of converting True or False to a 1 or 0?

Message 2 of 10
(5,071 Views)
Message 3 of 10
(5,061 Views)

I'm confused. Do you want to multiply two boolean arrays? Wouldn't that be the same result as just AND-ing them?

Jarrod S.
National Instruments
Message 4 of 10
(5,046 Views)

Sorry, I wanted to multiply a boolean array with a numeric array. (Thanks

0 Kudos
Message 5 of 10
(5,021 Views)

Hi

 

I have 2D boolean array, and I need to convert each row individually to a numeric 1D array like this

 

0:0:0 ----> 0

1:0:0 ----> 1

0:1:0 ----> 2

.

.

.

1:1:1----> 7

 

8x3 array to 8x1

 

 

I tried by Boolean Array To Number function, but it doesn't work because of the difference in the array dimensions, how can I do that?

 

Thank you

 

 

 
0 Kudos
Message 6 of 10
(4,464 Views)

Convert each row of the 2D array to an integer using Boolean Array to Number inside an auto-indexing For Loop.

 

2d-bool.png

 

 

---
CLA
Message 7 of 10
(4,456 Views)

Hi ysma,

 

"oh all those wonders of AUTOINDEXING"

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 10
(4,455 Views)

Thank you very much both of you....Heart

 
0 Kudos
Message 9 of 10
(4,421 Views)

@ysma wrote:

Thank you very much both of you....Heart

 

You can thank them by giving them Kudos.

0 Kudos
Message 10 of 10
(4,396 Views)