I am trying to read a txt file which has hexadecimal data. I Want to convert them in decimal except one column which I want to convert into binary bits and write them in 8 separate columns. Sample data set
1/4/2010 15:31 <00000> 0x0001 0x0010 0x0014 0x0000 0x0142 0x0001 0x0001 0x0000 0x028F 0x2007 0x0105 0x00AA 0x005A 0xFA8C 0xFACD 0xFAED 0x003B 0xFFA3 0xFFDE 0x0080 0xFEE0 0xFF2E 0x0000 0x0108 1/4/2010 15:31 <00000> 0x0001 0x0010 0x0014 0x0000 0x0143 0x0001 0x0001 0x0000 0x028F 0x2008 0x0105 0x00AA 0x005B 0xFA8C 0xFACC 0xFAEE 0x003C 0xFFA3 0xFFDE 0x0080 0xFEE0 0xFF2E 0x0000 0x0108 1/4/2010 15:31 <00000> 0x0001 0x0010 0x0014 0x0000 0x0144 0x0001 0x0001 0x0000 0x028F 0x2009 0x0105 0x00A9 0x005C 0xFA8C 0xFACC 0xFAF0 0x003B 0xFFA3
clear all; %
[b,pathb]=uigetfile({'*.txt'},'Select the file','C:\Data\2010');
file2=[pathb b];
data=dlmread('file2', '\t', 2, 1);
newdata=hex2dec(data);
Now I do not know how to get rid of 0x in all the values and I need to convert the last column into binary and write in 8 columns.
Any help is highly appreciated. thanks