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


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

Re: Hex 2 dec conversion

From Hans-Bernhard Bröker <HBBroeker@t-online.de>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Hex 2 dec conversion
Date 2019-12-11 23:40 +0100
Message-ID <h5d9ihFn8o4U1@mid.dfncis.de> (permalink)
References <97645b00-a063-4b6e-a994-90622b875eca@googlegroups.com>

Show all headers | View raw


Am 11.12.2019 um 19:43 schrieb Robert Vanpass:
> Hi,
> 
> I have a .csv datafile with only 2-digit numbers in Hexadecimal form:
> 6F
> 73
> A5
> ...

That has surprisingly few commas and semicolons for a csv file :-)

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

There's the "send the data through an external program before use"
function, but that's not terribly useful if you know no external program
to do that kind of transformation job for you.

In the Unix environment gnuplot originally grew up in, it would work
roughly like this:

  plot "< awk -e '{printf \"%d\", strtonum (\"0x\" $1)) }' yourfile.csv"

If you do have an 'awk' command around, that should actually work even
on Windows.

OTOH, if it's actual CSV and you're on Windows, you might want to follow
the saying "when in Rome, do as the Romans" and just perform the
transformation in you preferred spreadsheet program...

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