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

Home » Public Forums » archive » Re: Convertion from binary string to 16bit integer
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: Convertion from binary string to 16bit integer [message #56202 is a reply to message #56199] Mon, 15 October 2007 15:47 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Sun, 14 Oct 2007 02:21:49 -0700, Tal wrote:

> Hi guys,
>
> Great help with this int2bin code from 2005 (1993):
> http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/thread/61b692e9e403ef59/bdc5ce69d034eb17?hl=en&lnk =gst&q=int2bin
>
> Has anyone wrote an inverse code like bin2int or something equivalent?
> It would be generally to sum up all products of 2^i values with the
> corresponding 1's and 0's that a binary string has. (i=0,15 or 0,7 for
> example).
>
> The solution i'm looking for is for a 16bit binary string.

int=0L & reads,'1100110',FORMAT='(B)',int
print,int

I don't know how int2bin works, but it could work using string itself:

bin=string(int,FORMAT='(B0)')

JD
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: for loop elimination
Next Topic: ENVI ROUTINES

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

Current Time: Wed Oct 08 18:09:35 PDT 2025

Total time taken to generate the page: 0.00434 seconds