Prev: Basics
Next: hyperbolic interpolation
From: Albono Bonomi on 10 Mar 2010 02:33 Hi guys, does anyone knows how to convert a 8-bit data in the two's complement format back to signed decimal number? Thanks, AL
From: James Tursa on 10 Mar 2010 03:03 "Albono Bonomi" <alb.bonomi(a)gmail.com> wrote in message <hn7hvl$37c$1(a)fred.mathworks.com>... > > Hi guys, > > does anyone knows how to convert a 8-bit data in the two's complement format back to signed decimal number? > > Thanks, > > AL Depends on how you currently have it stored. Assuming it is in a double value you can use typecast like this: d = 255 u8 = uint8(d) s8 = typecast(u8,'int8') d = double(s8) James Tursa
From: Albono Bonomi on 10 Mar 2010 03:22 It works, problem solved. Thank you James. "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hn7joa$fin$1(a)fred.mathworks.com>... > "Albono Bonomi" <alb.bonomi(a)gmail.com> wrote in message <hn7hvl$37c$1(a)fred.mathworks.com>... > > > > Hi guys, > > > > does anyone knows how to convert a 8-bit data in the two's complement format back to signed decimal number? > > > > Thanks, > > > > AL > > Depends on how you currently have it stored. Assuming it is in a double value you can use typecast like this: > > d = 255 > u8 = uint8(d) > s8 = typecast(u8,'int8') > d = double(s8) > > James Tursa
|
Pages: 1 Prev: Basics Next: hyperbolic interpolation |