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.
jesusgonzalez
Posts: 1
Joined: Tue Apr 19, 2011 3:40 pm

Code requires creating many matrices

Unread post by jesusgonzalez »

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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Code requires creating many matrices

Unread post by TomDoan »

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).
Post Reply