Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4276

Re: Hex 2 dec conversion

From Karl Ratzsch <mail.kfr@gmx.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Hex 2 dec conversion
Date 2019-12-12 22:10 +0100
Organization solani.org
Message-ID <qsuaco$i2v$1@solani.org> (permalink)
References <97645b00-a063-4b6e-a994-90622b875eca@googlegroups.com> <h5d9ihFn8o4U1@mid.dfncis.de>

Show all headers | View raw


Am 11.12.2019 um 23:40 schrieb Hans-Bernhard Bröker:
> Am 11.12.2019 um 19:43 schrieb Robert Vanpass:
>> I have a .csv datafile with only 2-digit numbers in Hexadecimal form:

>> Is there a function in Gnuplot to convert these Hex numbers to Decimal form,
> No.

Actually yes. Gnuplot understands hexadecimal (and octal), the
number just needs a preceeding "0x" (or "0") marker. You just have
to add it in your "using" statement, and then take advantage of
gnuplot´s automatic type promotion:

$dat << EOD
11c 4
12a 5
133 4
13f 6
1aa 1
EOD

pl $dat us (("0x".strcol(1))*1):2 w l

Admittedly, I was very doubtful too before seeing the above example
actually producing a plot. ;)


Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hex 2 dec conversion Robert Vanpass <robertvanpass@gmail.com> - 2019-12-11 10:43 -0800
  Re: Hex 2 dec conversion Robert Vanpass <robertvanpass@gmail.com> - 2019-12-11 10:46 -0800
  Re: Hex 2 dec conversion Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2019-12-11 23:40 +0100
    Re: Hex 2 dec conversion Karl Ratzsch <mail.kfr@gmx.net> - 2019-12-12 22:10 +0100
  Re: Hex 2 dec conversion Robert Vanpass <robertvanpass@gmail.com> - 2019-12-14 11:28 -0800
  Re: Hex 2 dec conversion Robert Vanpass <robertvanpass@gmail.com> - 2019-12-14 23:19 -0800

csiph-web