Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: passing a function name as an argument to another function in Mata


From   Zurab Sajaia <zsajaia@hotmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: passing a function name as an argument to another function in Mata
Date   Tue, 23 Aug 2011 15:36:20 -0400

Dear all,
 
I'm trying to write a function that receives name of another function as an argument and executes it. So it's something like this:
 
 
functin myexecute(string scalar fname)
{
   ... somehow execute fname...
} 
 
 
 
:myexecute("myfunction()")
 
 
I can't use p=&functname() construct to than pass the pointer p to myexecute() and couldn't find any other option. Any suggestions whether this is possible at all?
 
Thanks,
Zurab
 
  		 	   		  
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index