Am 03.11.2019 um 10:23 schrieb Marcin Błażejowski:
Hi,
is it possible to use "%x" formatter in conjunction with "%m" in
sscanf
(i.e. perform hex-to-int conversion of array of strings into a matrix)?
I didn't even know that %x is supported in gretl's sscanf (not
documented I think), but it seems to work in plain usage. I wouldn't
know how to combine this with the special construct %m.
But if you already know that your input can only be hex integers,
perhaps simply do something like this:
<hansl>
matrix m
strings s2 = defarray("A","B")
string sf = toupper(flatten(s2))
string s = strsub(sf, "A", "10")
s = strsub(s, "B", "11")
s = strsub(s, "C", "12")
s = strsub(s, "D", "13")
s = strsub(s, "E", "14")
s = strsub(s, "F", "15")
sscanf(s, "%m", m)
print m
</hansl>
cheers
sven