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 linear indexing to accomplish this.
First, construct a matrix made out of zeros:
A = zeros(max(r),max(c));
Then set the elements to 1:
1
A( size(A,1) * (c-1) + r ) = 1;