From: James Tursa on 27 May 2010 18:25 Walter Roberson <roberson(a)hushmail.com> wrote in message <htmqqd$6vm$1(a)canopus.cc.umanitoba.ca>... > > Hmmm, looking further, it appears that Matlab is now only offered for "big > endian" systems Huh? PC's are Little Endian. James Tursa
From: Walter Roberson on 27 May 2010 18:39 James Tursa wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <htmqqd$6vm$1(a)canopus.cc.umanitoba.ca>... >> >> Hmmm, looking further, it appears that Matlab is now only offered for >> "big endian" systems > > Huh? PC's are Little Endian. I knew something looked wrong as I was typing it, sigh.
From: Thanushka on 27 May 2010 18:43 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <htmrg2$fuo$1(a)fred.mathworks.com>... > Walter Roberson <roberson(a)hushmail.com> wrote in message <htmqqd$6vm$1(a)canopus.cc.umanitoba.ca>... > > > > Hmmm, looking further, it appears that Matlab is now only offered for "big > > endian" systems > > Huh? PC's are Little Endian. > > James Tursa I'm running Matlab R2009a and this solution seems to be working fine. The data is stored in a matrix which seems to default to double data type. Thanks a lot to both replies. Much appreciated.
From: Thanushka on 27 May 2010 18:49 Walter Roberson <roberson(a)hushmail.com> wrote in message <htmqqd$6vm$1(a)canopus.cc.umanitoba.ca>... > Thanushka wrote: > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > <htmp2a$48f$1(a)canopus.cc.umanitoba.ca>... > >> Thanushka wrote: > >> > >> > I am currently doing a project and am a novice to Matlab. I have a > > >> problem where i receive serial 'dataframes', each consisting of two > > >> 8-bit values (the high byte and the low byte), which have to be > > >> constructed to get a 16-bit value. This assembled value is already in > >> > two's complement and I need to get the original value. > > >> typecast([uint8(HighByte), uint8(LowByte)], 'int16') > >> > >> On some systems you may need to reverse the high and low bytes. > > > Thanks but by the original value i meant the value before taking the > > two's complement. My original post may not have been clear. Sorry. eg: > > LowByte = 0xFE HighByte = 0xFF Answer should equal -2 > > As I said, you may need to reverse the bytes on some systems. > > >> typecast(uint8([hex2dec('FE'),hex2dec('FF')]),'int16') > ans = > -2 > > > Hmmm, looking further, it appears that Matlab is now only offered for "big > endian" systems, so reversing the bytes is possibly needed on all current > Matlab systems. Still, there are plenty of people around running older Matlab > releases, possibly on systems that are little-endian . I'm running Matlab R2009a and this solution seems to be working fine. The data is stored in a matrix which seems to default to double data type. Thanks a lot to both replies. Much appreciated.
From: Thanushka on 28 May 2010 06:00 "Thanushka " <galazz442(a)gmail.com> wrote in message <htmshq$lmk$1(a)fred.mathworks.com>... > "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <htmrg2$fuo$1(a)fred.mathworks.com>... > > Walter Roberson <roberson(a)hushmail.com> wrote in message <htmqqd$6vm$1(a)canopus.cc.umanitoba.ca>... > > > > > > Hmmm, looking further, it appears that Matlab is now only offered for "big > > > endian" systems > > > > Huh? PC's are Little Endian. > > > > James Tursa > > > I'm running Matlab R2009a and this solution seems to be working fine. The data is stored in a matrix which seems to default to double data type. Thanks a lot to both replies. Much appreciated. Maybe unrelated but any idea how to implement this in C#? Thanks in advance....
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: How to merge two matrix Next: How to read a string and convert it into array?? |