BINARY Name
BINARY
Purpose
This function is used to display a binary representation of byte,
integer, and long integer values.
Author
FANNING SOFTWARE CONSULTING
David Fanning, Ph.D.
1645 Sheely Drive
Fort Collins, CO 80526 USA
Phone: 970-221-0438
E-mail: david@idlcoyote.com
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Category
Utilities
Calling Sequence
output = Binary(theNumber) Return Value
output: A string array of 0s and 1s to be printed (normally), in a
binary representation of the number. The number is represented with
the highest bits on the left and the lowest bits on the right,
when printed with the PRINT command.
Arguments
theNumber: The number for which the user wants a binary representation.
It must be BYTE, INT, or LONG.
Keywordrs
COLOR: If this keyword is set, the binary representation always
contains 24 bits of output.
SEPARATE: If this keyword is set, the output is separated with space
between each group of eight bits.
Example
IDL> Print, Binary(24B)
0 0 0 1 1 0 0 0
IDL> Print, Binary(24L)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
IDL> Print, Binary(24L, /COLOR)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
IDL> Print, Binary(24L, /COLOR, /SEPARATE)
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0
Modification History
Written by: David W. Fanning, November 10, 2007.
Fixed a problem with error handling. 13 March 2008. DWF.