Index matrices to do an algorithm

Hello,

I would like to index matrices to make algorithms like
for(i in 1:100){mat_i [a,b] = i}

So I need that my algorithm selects a different matrix at each loop.
We can't create it by typing mat_i because i considered just as a letter and not a variable.

its probably most pracitcal for your to use 3 dimensional array, consider

(my.array<-array(1:(4*3*2),dim=c(4,3,2)))
, , 1

     [,1] [,2] [,3]
[1,]    1    5    9
[2,]    2    6   10
[3,]    3    7   11
[4,]    4    8   12

, , 2

     [,1] [,2] [,3]
[1,]   13   17   21
[2,]   14   18   22
[3,]   15   19   23
[4,]   16   20   24

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.