Hi,
I am writing a program interacted with Mata. I do not know how to keep the output of Mata in the Mata environment. Let's have a look at the following simple multiplication program:
Simply run the matafunc program:
M is the output of the program, which is two times Z (the input). This can be sent to Stata by adding st_matrix("M",M) to the end of the mataf function. How can I keep a copy of M in mata though?
Thanks,
Eilya.
I am writing a program interacted with Mata. I do not know how to keep the output of Mata in the Mata environment. Let's have a look at the following simple multiplication program:
Code:
capture program drop matafunc program define matafunc syntax , VARiable(string) mata: mataf("`variable'") end mata function mataf(V) { st_view(Z,.,V) M = Z*2 } end
Code:
clear set obs 5 gener double Z = runiform() matafunc, var(Z)
Thanks,
Eilya.
Comment