Borrar filtros
Borrar filtros

Index exceeds matrix dimensions

1 visualización (últimos 30 días)
Rahul Pillai
Rahul Pillai el 11 de Nov. de 2017
Editada: per isakson el 12 de Nov. de 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 comentarios
Rahul Pillai
Rahul Pillai el 12 de Nov. de 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 el 12 de Nov. de 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!

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by