Index exceeds matrix dimensions
1 view (last 30 days)
Show older comments
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?
3 Comments
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!