I am new to MATLAB.
我是MATLAB的新手。
I have a sparse matrix (2649429x148
) which I got through spconvert
function. It is a sparse user-movie matrix. I want to get all the ratings for a particular movie. The user-id space has some gaps and is not continuous.
我有一个稀疏矩阵(2649429x148),我通过spconvert函数。它是一个稀疏的用户电影矩阵。我希望获得特定电影的所有评分。用户ID空间有一些间隙,不连续。
I tried the following
我尝试了以下内容
mat
(967,1) 1
(7798,1) 4
(16272,1) 2
(21722,1) 3
.
.
.
(11,148) 5
(2342432,148) 5
(2332332,148) 5
mat(:,4) % it get the following
(967,1) 1
(7798,1) 4
(16272,1) 2
(21722,1) 3
(42773,1) 3
(48286,1) 5
(98649,1) 2
(156319,1) 2
(165720,1) 2
.........
I want to get (xxxxxx, 4) .....
我想得到(xxxxxx,4).....
How can I get a column vector of all the ratings for a particular movie?
如何获取特定电影的所有评级的列向量?
1 个解决方案
#1
1
Check this out if it works -
检查一下它是否有效 -
[~,col1,val] = find(mat);
ratings = val(col1==4)
#1
1
Check this out if it works -
检查一下它是否有效 -
[~,col1,val] = find(mat);
ratings = val(col1==4)