From help-octave-bounces at octave dot org Mon Apr 17 17:37:49 2006 Subject: Re: hex format From: "Dmitri A. Sergatskov" To: "Donald J Bindner" Cc: help at octave dot org Date: Mon, 17 Apr 2006 16:29:53 -0600 On 4/17/06, Donald J Bindner wrote: > On Mon, Apr 17, 2006 at 02:37:30PM -0600, Dmitri A. Sergatskov wrote: > > On 4/17/06, NZG 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 > Regards, Dmitri. -- _______________________________________________ Help-octave mailing list Help-octave at octave dot org https://www.cae.wisc.edu/mailman/listinfo/help-octave