I have a 3020X1860 matrix srtloc
that looks like this:
1 2 3 . . . 1860
______________
1|31 77 88
2|88 213 235
3|213 235 304
4|235 304 327
.
.
.
3020
I want to create a new matrix that has
first row: 1 in the 31st column, a 2 in the 77th column, 3 in 88th column...
second row: 1 in the 88th column, 2 in 213th column, 3 in 235th column...
third row: 1 in the 235th colum, 2 in 304th column, 3 in 327th column...
and so on. To do this right now, I'm using nested for loops, and having speed issues:
pctrank = NaN(3020,1860)
for rkix1 = 1:3020
for rkix2 = 1:1860
rowz = srtloc(rkix1,:);
pctrank(rkix1,rowz(rkix2)) = rkix2;
end
end
Is there a vectorized way to do this?