Page 1 of 1

Code requires creating many matrices

Posted: Tue Apr 19, 2011 5:05 pm
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

Re: Code requires creating many matrices

Posted: Tue Apr 19, 2011 7:14 pm
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).