LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert 1D array of byte to boolean

hi
 
I would like to convert an array of byte into boolean arry. I've tried many solutions but there 's always something wrong.
 
I've tired to use a for loop. The problem is :  with indexing I can't wire and without I obtain only the last byte!
 
Someone can help me or give me some advices.
 
thanks
0 Kudos
Message 1 of 11
(10,344 Views)
The easiest way is to simply compare against zero value using greater than from numeric palette.  See attached picture.
 
0 Kudos
Message 2 of 11
(10,338 Views)
thanks for your answer but it's not exactly what I need.
 
As you could see in  1.vi , I've an array of 8 boolean (data) I choose to receive only 2 bytes.
 
And I would like to see each bit of the 2 bytes.
 
 
0 Kudos
Message 3 of 11
(10,331 Views)
Wire your array 2 to a for loop. Inside the for loop, put a Number to Boolean Array function. Wire the output of that to the edge of the for loop. This will create a 2D array where each row will represent each element in array 2. If you need a 1D array, use the Reshape Array function and specify the dimension size (8 x the size of array 2).
Message 4 of 11
(10,325 Views)

IT WORKS!!

 

Thanks you for your help.

 

 

0 Kudos
Message 5 of 11
(10,320 Views)
Just as an additional note, initializing a "short" array of zeroes, then adding it to the input array is NOT the best way to take an array subset! 😉
 
In general, you would use the "array subset" tool.
(If the subset starts with element 0, you can also use "reshape array" to truncate to two elements as shown in the attached modification (LabVIEW 7.1)).
0 Kudos
Message 6 of 11
(10,301 Views)

Hi

 

 

How I can convert the boolean array to a byte array to convert it fainally to a string?

 

Thank yuo

 
0 Kudos
Message 7 of 11
(8,772 Views)

Hi ysma,

 

like this:

check.png

 

Please describe your desired goal more precisely. What kind of string do you want to receive? Do you need "TFFT" or "1001" or "9" in the end?

 

Btw. why do you high-jack a very old thread that isn't really related to your topic?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(8,761 Views)

Than you for your reply.

 

I need send a sting, letters, numbers or both in a communications system, I could convert a string to this system and transmitted s a boolean aray, I coud receive it, my probelm is getting the string back...

 

 

 
0 Kudos
Message 9 of 11
(8,757 Views)

Hi ysma,

 

pleasy describe the string more precisely, which you want to "get back". Provide examples...

Best regards,
GerdW


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