comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Extracting bits with IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Extracting bits with IDL [message #2594 is a reply to message #2592] Mon, 18 July 1994 01:58 Go to previous message
stl is currently offline  stl
Messages: 70
Registered: February 1994
Member
In article <Ct2GM1.1780@yuma.ACNS.ColoState.EDU> dean%phobos.dnet@sirius.cira.colostate.edu writes:
> .....
> contains some time information. Extracting individual bits from data with IDL
> is difficult. At first I consider building an IDL structure, but IDL is
> unable to break down to bits.
kinda sorta not/really (see below)
> The information can fit into LONARR(2). If anyone has any suggestion that
> would allow IDL to extract the information from these LONARR(2), please
> forward your comments to me or post them.

Hi,

okay, to strip a long apart bit by bit, simple test each bit. For
instance if you wish to check if the second bit was set (binary value of
0000 0000 0000 0010) AND it with 2, if the result is 2, the bit was set,
otherwise it was not. This can then be done for each bit, or you could
check groups of bits this way.
I am sure there are other methods of doing this, but this should be
pretty functional method. In IDL do something like the following:

x = 3L ;sample long data, lets test it to see if the second
; bit is set
if (x and 2) eq 2 then print,"second bit set" else $
print,"second bit wasn't set"


-hope this helps, and is what your looking for.

-stephen
--
Stephen C Strebel / SKI TO DIE
strebel@sma.ch / and
Swiss Meteorological Institute, Zuerich / LIVE TO TELL ABOUT IT
01 256 93 85 / (and pray for snow)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: DRAW_MOTION_EVENTS
Next Topic: translating an image....

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:44:17 PDT 2025

Total time taken to generate the page: 0.32193 seconds