I do have 2 vectors and i want to construct a matrix based onr and c
r =
1 2 4 6 8
c =
2 4 6 8 10
You could use the constructor for sparse matrices:
full(sparse(r,c,1))
by the way, if you want to apply this to large matrices with many zeros, stay with the sparse one. It uses much less memory for matrices with many zeros:
sparse(r,c,1)