help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hex format


From: Dmitri A. Sergatskov
Subject: Re: hex format
Date: Mon, 17 Apr 2006 16:29:53 -0600

On 4/17/06, Donald J Bindner <address@hidden> wrote:
> On Mon, Apr 17, 2006 at 02:37:30PM -0600, Dmitri A. Sergatskov wrote:
> > On 4/17/06, NZG <address@hidden> wrote:
> > > Whats a simple way to see a number in Octave in hex?
> > > I tried
> > > "format hex"
> > > but this isn't giving me what I want.
> > > 2 is not 0000000000000040
> > > by any conversion I've ever seen
> >
> > When you type "2" it is double 2 which is different
> > from e.g. uint8(2)
>
> I think what you want is something like this:
>
> octave:1> printf( "%x\n", 12 );
> c
>

Well, what I was trying to say is that number 2
by default in octave is float 2.0, so it represented
as 0000000000000040
If one wants integer 2, she has to use
int8(2) or similar.
"dec2hex" is another option:

octave:5> format native-hex
octave:6> 12
ans = 0000000000002840
octave:7> int8(12)
ans = 0c
octave:8> dec2hex (12)
ans = C

printf would work as well.

> --
> Don Bindner <address@hidden>
>

Regards,

Dmitri.
--



reply via email to

[Prev in Thread] Current Thread [Next in Thread]