Hello,
I'm trying to have a rapid way to output numbers to files, and wrote the
following:
# A function to dump numbers to files:
function scalar to_file(scalar numb, string format, string filename)
set echo off
set messages off
outfile filename --write
printf format, numb
outfile --close
set echo on
set messages on
return 0
end function
which however doesn't work. By trying different specifications, I think
I have understood that the "filename" parameter of "outfile" and the
"format" parameter of "printf" cannot be variables, they are parsed
directly as strings by the interpreter.
Did I understand correctly?
Is there anything I can do to solve my problem?
I do not care too much, in the end, about "format", but if there is no
way to pass an arbitraray string to "outfile" I'm clearly trying
something stupid.
Thanks in advance
Pietro