annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

unsigned byte too short

Risolto!
Vai alla soluzione

Hello,

 

Could anyone know why the maximal u8 value would be 128 instead of 255 as it should be? I am trying to convert an array of zeros and ones into the array of zeros nad 255's, so i am converting data array to u8 and trying to use rotate function (http://zone.ni.com/reference/en-XX/help/371361P-01/glang/rotate/) with y=-1...

 

Any help/ideas appreciated!

0 Kudos
Messaggio 1 di 5
3.412Visualizzazioni

You are not making any sense.

 

The max U8 value is 255 and if your rotate by -1, you'll end up with 127. Where does your 128 come from? What does an array of zeroes and ones have to do with any of this?

 

Can  you show us some code and real data?

0 Kudos
Messaggio 2 di 5
3.400Visualizzazioni
Soluzione
Accettato da JulIS

@JulIS wrote:

Hello,

 

Could anyone know why the maximal u8 value would be 128 instead of 255 as it should be? I am trying to convert an array of zeros and ones into the array of zeros nad 255's, so i am converting data array to u8 and trying to use rotate function (http://zone.ni.com/reference/en-XX/help/371361P-01/glang/rotate/) with y=-1...

 

Any help/ideas appreciated!


128 is is "10000000" in binary. It is the largest value of a U8 where only a single bit is set.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Messaggio 3 di 5
3.362Visualizzazioni
Soluzione
Accettato da JulIS

If you're just changing 1's to 255, multiply the array by a constant of 255.

 

multiply.png

 

If your data is a binary 1 (00000001) then no matter how you rotate it you'll never get to 255 (11111111). I guess you could subtract 2 from your number instead of rotating?

 

What are you actually trying to do here?

0 Kudos
Messaggio 4 di 5
3.353Visualizzazioni

Thank you all for your reply. Yes, I was doing something not very wise suggested by somebody else's code. Thanks a lot!

0 Kudos
Messaggio 5 di 5
3.340Visualizzazioni