Filter löschen
Filter löschen

Index exceeds matrix dimensions

1 Ansicht (letzte 30 Tage)
Rahul Pillai
Rahul Pillai am 11 Nov. 2017
Bearbeitet: per isakson am 12 Nov. 2017
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 Kommentare
Rahul Pillai
Rahul Pillai am 12 Nov. 2017
Hey Walter. Thanks for replying. Ele is not a problem here. It's a value that needs to change since xc and yc are a huge system of coordinates for some some units called 'nodes' that all exist in groups of 4. There are 'n' such groups and they all exist inside ele. There are thus, n such groups, where n=2500. I have made sure n is predefined to be 2500 in size. (hence ele is size 2500 x 4) .
Rahul Pillai
Rahul Pillai am 12 Nov. 2017
Hello. I seem to have figured the problem. I apparently changed the value of xc somwhere inside the ele for loop code block (I haven't shown it here as I thought this was the most important line of code that was affecting my answer). Thanks though!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by