I have one matrix *u_test* that contains the data from my test set.
It’s formats is like that:
X y value
1 3 5.0
1 6 3.4
4 3 2.0
I want to create a matrix test from *u_test*, so that the value of the rating is in it correct position, for example:
1 2 3 4 5 6
1: 5.0
2: 3.4
3:
4: 2.0
Is there a loop-free way to do this?
The easiest way is to use SPARSE
If the target size of the array should be
m-by-n, you can write insteadThe good thing about using sparse is that it won’t take too much space if the matrix
u_testis large. However, if for some reason you cannot use sparse, convert to a full matrix using