Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: [Mata] naming matrices in a loop


From   Antoine Terracol <[email protected]>
To   [email protected]
Subject   st: [Mata] naming matrices in a loop
Date   Thu, 18 Mar 2010 16:09:52 +0100

Dear _all

There must be an obvious way to solve my problem, but I just seem to be unable to find it...

In a Mata loop, I want to store the result of each pass into a separate matrix whose name depends on the value of the counter

It would look like:

for (n=1;n<=10;n++){
		...
		name_that_depends_on_n=<result of the calculation>
		}

so that I get 10 matrices named, for example, result1, result2, ..., result10.

In Stata, I would do something like

forvalues i=1/10 {
		...
		result`i'=<result of the calculation>
		}

	

How can this be done in Mata?

Best,
Antoine

--
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index