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

Home » Public Forums » archive » Re: Integer Array into Binary Array
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: Integer Array into Binary Array [message #67026 is a reply to message #67025] Thu, 25 June 2009 10:16 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Vikram writes:

> I have made use of Dr. Fanning's BINARY.PRO and I have written
> something:
>
> img = read_tiff('Resol_Test2C.tiff')
>
> target = lonarr(4,1280,1024)
>
> bin = where(img gt 0.0)
> num = n_elements(bin)
> target[bin] = img[bin]
>
> num = n_elements(target)
>
> output = lonarr(4,5,5)
>
> test = [343,494]
>
> for x=0, n_elements(test)-1 do begin
> output[x] = binary(test[x],/color)
> endfor
>
> ---------
> But if I do a print,output I can only get the binary for the 494, not
> both 343 and 494 in the same array. Any ideas?

BINARY produces string output. Maybe you want this:

IDL> test = [343,494]
IDL> print, test, format='(b24)'
101010111
111101110

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Integer Array into Binary Array
Next Topic: Saving XYOUTS

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

Current Time: Fri Oct 10 17:57:34 PDT 2025

Total time taken to generate the page: 1.35639 seconds