Re: How do I convert an array of hexadecimal numbers to integers? [message #12951] |
Tue, 22 September 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Robert Lematta (lematta@yahoo.com) writes:
> Does anyone out there have an simple idl routine to convert an array of
> hex numbers to an equal sized array of the equivlent integer numbers?
> For example the 4 by 6 array below. I have some huge hex datafiles that
> I am trying to plot and the only way I have found so far is to brute
> force the arrays.
>
> 79 86 A0 A0 A5 AB
> AB A3 A3 A6 A1 A6
> A3 9F A3 A9 AD AA
> A6 A7 A8 AD B7 AF
I'm not sure exactly what you mean by "an array of hex numbers".
If I put your little example data in a file, I read it like
this:
OpenR, lun, 'hex.dat', /Get_Lun
array = IntArr(6,4)
ReadF, lun, array, Format='(6(z2, x))'
Done. :-)
Cheers,
David
----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|