![]() |
| ||||||||||||||||||
![]() |
| ||||||||||||||||||
|
The same concept holds for multidimensional lists, but care must be taken that the list indices do not interfere,
best by separating them with an underscore '_':
for i=1 to 12
for j=1 to 12
wrongmatrix(i)(j)=i*j
rightmatrix(i)_(j)=i*j
Why is the first matrix wrong? Simply because the matrix elements
1,12 and 11,2 (like several others) map to the same variable name: wrongmatrix112. The underscore makes sure that the indices stay separated: rightmatrix1_12 and rightmatrix11_2 are indeed different names.
If you know the number of columns and rows in advance, you can use leading zeroes to avoid the underscore:
for i=01 to 12
for j=01 to 12
rightmatrix(i)(j)=i*j
In the above case, rightmatrix0112 and rightmatrix1102 correctly map to different variable names.
| ||||||||||||||||||