help-octave
[Top][All Lists]

## Re: Decimal to Hexadecimal - But not in the way you think!

 From: Ian McCallion Subject: Re: Decimal to Hexadecimal - But not in the way you think! Date: Thu, 15 Nov 2018 21:47:20 +0000

```Is this what you want?

a= dec2base(14,10)
base2dec(a,16)

Cheers... Ian
On Thu, 15 Nov 2018 at 21:31, ka1gt <address@hidden> wrote:
>
> For reasons I won't go into (another application), I need to convert a
> decimal number into a hexadecimal number - but not in the usual way.
>
> As an example I need to convert the integer "*14*" into the hexadecimal
> number "0x*14*"
>
> Is there a simple way to do this? I thought of number  -> string -> number,
> but there's no string to hex conversion as far as I can see.
>
> I could do it by taking the integer "14", splitting it up into 1 and 4,
> taking (1*16)+(4) = 20 and then converting 20 to a hex number which gives me
> "0x14", but is there a simpler way to do this that I'm missing?
>
>
>
> --
> Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
>
>

```