hex data to integer

Hi,

I do have a sensor which sends out lines of hexadecimal data what look like this:

0006 0006 0004 0002 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0013 0DB0 04E0
0012 0004 0000 0001 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0018 0D88 04E0
0011 0003 0002 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0017 0DB2 04E0
0011 0003 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0015 0DBB 04E0
0010 0004 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0015 0DA7 04E0
0018 0002 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 001B 0DA8 04E0
0072 0082 0085 006E 0048 008A 018B 0277 02A4 01EB 0077 001A 0004 0000 0000 0001 0BE0 0C41 04E0
0059 0055 0056 004B 002C 005E 0109 0137 013A 007F 0015 0004 0000 0001 0000 0000 05EC 0CF7 04E1
003B 0039 0048 0042 003B 0043 0100 011A 011C 0074 0015 0004 0002 0000 0001 0000 0542 0D58 04E1
0043 0051 0046 0023 0017 0031 009C 00C2 00C7 004B 000D 0000 0000 0001 0000 0000 03C3 0C63 04E1
0044 003E 003C 0037 0017 004C 00A9 00CE 00BF 0058 000E 0003 0000 0000 0000 0000 03F7 0CC0 04E0
0041 0037 002A 002F 001E 0041 00B7 00BA 00AD 002D 0005 0002 0000 0000 0000 0000 0382 0D83 04E0
000F 0009 000A 0006 0005 0004 000E 000F 0014 0004 0005 0000 0000 0000 0000 0000 006B 0DCC 04E0
0015 000B 0003 0005 0004 0009 000B 0010 0008 0003 0001 0000 0000 0000 0000 0000 005C 0DCB 04E0
000E 0004 0006 0001 0000 0004 0009 000B 0006 0001 0000 0000 0000 0000 0000 0000 0038 0DB5 04E0
000D 0006 0002 0001 0000 0000 0001 0001 0001 0001 0000 0000 0000 0000 0000 0000 001A 0DB7 04E0
000D 0003 0000 0004 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0015 0DCF 04E0
0013 0002 0001 0001 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0018 0DD4 04E0
001A 0005 0002 0002 0000 0001 0001 0000 0002 0000 0000 0000 0000 0000 0000 0000 0027 0DE0 04E0

 

I would like to convert those to integer numbers. But I do not find a hint how to do that. Any help?

Thanks!

balumbala

If you look at the help for LoadWave, you can specify the column format to be a hexadecimal number:

LoadWave /B="F=10;" ... DisplayHelpTopic("LoadWave")

Hope this gives you an idea.

 

Hi KurtB,

Thanks for your fast answer. Well, sorry, I did not describe the dataset well enough:

it is an ascii file wich contains the hex numbers above.

I would like to read this ascii file and transform the 19 hex number waves to decimal.

 

balumbala

In reply to by balumbala

The following appears (in my quite testing) to load the data into a matrix wave:

LoadWave/J/F={19,5,0}/B="C=1,F=10,W=4;C=19,F=10,W=5;"/M myFileName

This may well not be applying all the flags properly - I just played around until I got something that appears to work.

You then just need to convert that to a 1D wave, or do whatever you need thereafter.

Good luck!

Kurt

EDIT:

There is probably a matrix op that does this better, but the following converts it to a 1D wave...

Wave wTemp = wave0 // replace wave0 with your own loaded wave name
MatrixTranspose wTemp
ReDimension/N=(DimSize(wTemp,0) * DimSize(wTemp,1)) wTemp