Say you have a simple text file which contains many columns. Some columns are decimal values already. Some are hexadecimal. Those columns are known.
test.txt >>
1.4 1.9 21 0030 0D12
0.3 3.3 91 FFFF 1111
I want to read the first three columns as decimal, and read the last two columns as hex.
Can this be done easily?
Thanks!
It can easily be done by
textread. For your example, just do:This will read the decimal values normally, and treat the hexadecimal values as strings.
If you further wish to convert the strings into decimal values as well, use
hex2decwithcellfun:Hope this helps.