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

Home » Public Forums » archive » Re: assign an octal number to a variable
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: assign an octal number to a variable [message #62879] Tue, 14 October 2008 00:53 Go to next message
duxiyu@gmail.com is currently offline  duxiyu@gmail.com
Messages: 88
Registered: March 2007
Member
The function in the page is designed to express a decimal number in a
binary or hexadecimal representation.
However, the function I want is to assign a binary or hexadecimal
number to a variable.

For example, the expression (A="30) means that assign the octal number
30 to A.
If you print it in the decimal representation, it will give the result
24.

I am looking for the method to assign a binary or hexadecimal number
(such as 1101011 or 8AE3) to a variable.


Best regards,
Du



On Oct 14, 1:09 am, David Fanning <n...@dfanning.com> wrote:
> dux...@gmail.com writes:
>> I found a method to assign an octal number to a variable.
>
>> For example,
>>        a="30
>>        print,a
>> It seems that the double quotation mark befroe the number can indicate
>> this number is octal value.
>> But I do not find its detailed directions in IDL help.
>
>> In the similar way, which symbol can indicate the binary and
>> hexadecimal number?
>
> I hate to mention it, but I spent quite a bit of time putting
> a search engine on Coyote's Guide to IDL Programming for just
> this purpose. :-)
>
>   http://www.dfanning.com/misc_tips/binary_hex.html
>
> If you want to see where octal (and hexadecimal) numbers
> are defined, something like "octal" in the on-line help
> index works pretty well.
>
> 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.")
Re: assign an octal number to a variable [message #62884 is a reply to message #62879] Mon, 13 October 2008 16:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
duxiyu@gmail.com writes:

> I found a method to assign an octal number to a variable.
>
> For example,
> a="30
> print,a
> It seems that the double quotation mark befroe the number can indicate
> this number is octal value.
> But I do not find its detailed directions in IDL help.
>
> In the similar way, which symbol can indicate the binary and
> hexadecimal number?

I hate to mention it, but I spent quite a bit of time putting
a search engine on Coyote's Guide to IDL Programming for just
this purpose. :-)

http://www.dfanning.com/misc_tips/binary_hex.html

If you want to see where octal (and hexadecimal) numbers
are defined, something like "octal" in the on-line help
index works pretty well.

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.")
Re: assign an octal number to a variable [message #62966 is a reply to message #62879] Tue, 14 October 2008 08:29 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Oct 14, 1:53 am, "dux...@gmail.com" <dux...@gmail.com> wrote:
> I am looking for the method to assign a binary or hexadecimal  number
> (such as 1101011 or 8AE3) to a variable.

IDL> print, 'FF'x
255
IDL> print, '100'b
4
IDL> print, '77'o
63

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: HDF_VD_WRITE for string data
Next Topic: HDF_VD_WRITE for string data

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

Current Time: Wed Oct 08 19:51:30 PDT 2025

Total time taken to generate the page: 0.00626 seconds