Am 19.10.2018 um 15:44 schrieb Allin
Cottrell:
On Fri, 19
Oct 2018, Sven Schreiber wrote:
Is this still on the table? (To extend the coverage of 'atof' in
core gretl.)
If not, the matof() function of this thread a while ago would
also be a candidate for inclusion into extra.
Check out sscanf() first.
Thanks for the hint. What's missing then (AFAICS) is a function that
reverses strplit, that is, joins the members of an array of strings
into a (separator-separated) single string.
Brute force:
function string arr2sepstr(strings S, string sep[null])
if !exists(sep)
string sep = " " # blank as default
endif
string out = ""
loop i=1..nelem(S) -q
out ~= S[i] ~ sep
endloop
# discard trailing separator
return substr(out, 1, nelem(out)-1)
end function
The rest indeed seems to be done by sscanf(arr2sepstr(Sarr), %m,
mymatrix).
cheers,
sven