Re: Read words coded on 3 bytes (24 bits) in IDL [message #30680] |
Fri, 10 May 2002 10:52 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
cinthia.loial@infoterra-global.com (Cinthia) writes:
> Hi all,
>
>
> Any suggestion to read words coded on 3 bytes (24 bits) in IDL?
Yes. Read first as bytes, then convert to whatever you need.
bb3 = bytarr(3, NWORDS)
readu, unit, bb3
For example to convert to long, you would fill it into a 4-byte array,
then convert to long:
bb4 = bytarr(4, NWORDS)
bb4(0:2,*) = bb3
ll = long(bb4, 0, NWORDS)
Then at that stage you may need to do bit twizzling, depending on your
architecture, using the BYTEORDER procedure.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|