On Fri, 5 Jan 2007, Sven Schreiber wrote:
>> I do see "include" as problematic (since that's
designed for importing
>> function definitions), but "run" is not so bad. In current CVS you
can
>> invoke "run" inside functions (though this is not much tested).
This works like a charm for me! Tested with 'matrix' and 'print'
commands in the file which is run. Very cool, now everything
fits together!
Glad to hear it!
Of course this immediately leads to new questions: Is it
possible to return more than one matrix from the function? I
tried to adapt section 10.2 of the user guide, but only got
error messages.
You can do this, but the "extra" returns have to be indirect. You
need to update your copy of the user guide!
http://ricardo.ecn.wfu.edu/pub/gretl/manual/PDF/
(Though there should be a way of doing this via the GUI.)
Trivial example:
function matfun (matrix *B, matrix *C)
matrix A = mnormal(2,2)
matrix B = mnormal(2,2)
matrix C = mnormal(2,2)
return matrix A
end function
nulldata 10
matrix B
matrix C
matrix A = matfun(&B, &C)
print A B C
Allin.