Index exceeds matrix dimensions
1 次查看(过去 30 天)
显示 更早的评论
Can't seem to figure out what's wrong with this code. The error points to the 3rd line of code here:
for ele = 1:n
for i=1:4
x(i,1)=xc(elems(ele,i),1);
y(i,1)=yc(elems(ele,i),1);
end
end
In case you're wondering, here are the sizes of all matrices involved:
x: 4x1
y: 4x1
xc: 2601x1
yc: 2601x1
elems: 2500x4
Also, the highest value returned by elems(ele,i) is 2601 and the lowest is 1 . Everything else is an integer between 1 and 2601, which are all permissible indices for xc. Any thoughts on this?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!