Subscripted assignment dimension mismatch.
显示 更早的评论
Hello, I am attempting to separate a large matrix into two parts for kernel formation for clustering with a kernel k-means algorithm. While I would ordinarily jus reshape it into a third dimension, this option is impossible given that the number of columns in the matrix in question is odd (24021). I have been unable to perform any of the things that I have seen before, such as indexing. Below is the method I tried, which returned the above error message.
EDU>> for n=1:24041
if n<=12021
split{1}(n)=test(:,n);
elseif n>12021
split{2}(n-12021)=test(:,n)
end
end
Subscripted assignment dimension mismatch.
If anyone can tell me what is going on, I would greatly appreciate it. Thanks in advance.
采纳的回答
更多回答(1 个)
You are probably trying to assign a matrix to a scalar:
split{1}(n)=test(:,n);
split{1}(n) is most likely a scalar
test(:,n) is probably a column vector
3 个评论
Walter Roberson
2013-1-12
test(:,1) would have to be a row vector.
José-Luis
2013-1-12
Now I see what you meant. I need some coffee.
类别
在 帮助中心 和 File Exchange 中查找有关 k-Means and k-Medoids Clustering 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!