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 #56212 is a reply to message #56209] Mon, 15 October 2007 01:55 Go to previous message
sjwelch is currently offline  sjwelch
Messages: 5
Registered: October 2007
Junior Member
Long time reader, first time poster. Greetings to all.

assuming you have a 16 character, left '0' padded string, strbin

number = total((byte(strbin) - 48b) * (2L ^ reverse(bindgen(16))))

that's what IDL does best ;) sure there's a simpler way too...

On Oct 14, 8:21 pm, Tal <t...@bar-kal.com> wrote:
> Hi guys,
>
> Great help with this int2bin code from 2005 (1993):http://groups.google.com/group/comp.lang.idl-pvwave/b rowse_thread/thr...
>
> 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.
>
> Cheers,
> Tal
[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 Dec 03 11:11:54 PST 2025

Total time taken to generate the page: 1.03783 seconds