building a matrix one row at a time is not a very efficient way to code (since the matrix is expanding it will require re-allocation of memory!). however, it can be done. have a look at the following toy example:
> C = c(0, 0, 1)
> for (n in 1:10) {
+ x <- c(n, 2*n, n+1)
+ C <- rbind(C, x)
+ }
> C
[,1] [,2] [,3]
C 0 0 1
x 1 2 2
x 2 4 3
x 3 6 4
x 4 8 5
x 5 10 6
x 6 12 7
x 7 14 8
x 8 16 9
x 9 18 10
x 10 20 11
C starts out as a vector. each call to rbind() appends another row onto the matrix. obviously the new row has to have as many columns as there are in the existing matrix.
Alternatively, to avoid the pre-allocation issue but still use rbind(), you could assemble the data in a list (no penalty on re-allocation and also no need to determine the number of elements up front) and then convert to a matrix when you are done.
> C = list()
>
> for (n in 1:10) {
+ C[[n]] <- c(n, 2*n, n+1)
+ }
>
> do.call(rbind, C)
[,1] [,2] [,3]
[1,] 1 2 2
[2,] 2 4 3
[3,] 3 6 4
[4,] 4 8 5
[5,] 5 10 6
[6,] 6 12 7
[7,] 7 14 8
[8,] 8 16 9
[9,] 9 18 10
[10,] 10 20 11