Code requires creating many matrices

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.

Code requires creating many matrices

Postby jesusgonzalez » Tue Apr 19, 2011 5:05 pm

How can I write a small loop to create many similar matrices with different names like mat1, mat2, mat3, etc?
I have to declare and fill many matrices but should not do it one by one.
Is there a "do" loop structure that can be used?
Thank you
jesusgonzalez
 
Posts: 1
Joined: Tue Apr 19, 2011 3:40 pm

Re: Code requires creating many matrices

Postby TomDoan » Tue Apr 19, 2011 7:14 pm

jesusgonzalez wrote:How can I write a small loop to create many similar matrices with different names like mat1, mat2, mat3, etc?
I have to declare and fill many matrices but should not do it one by one.
Is there a "do" loop structure that can be used?
Thank you


The best way to handle that is almost certainly to use a VECT[RECT] structure, like

dec vect[rect] mat(100)

which will create 100 matrices which you would references as mat(1), ..., mat(100).
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 1 guest