index out of bounds
조회 수: 9 (최근 30일)
이전 댓글 표시
Hi I'm trying to execute a program but I keep getting this error:
"Attempted to access indx(1); index out of bounds because numel(indx)=0" I understand what it means, but I'm not able to fixe it, I need some help.
The main function is GAmodule and you can insert these numbers :
235
2
2
4
0
0
0
10
0
0
5
0
10
5
5
10
g
500
I got stuck in this error for 1 month and I will be very appreciate any help.
댓글 수: 0
채택된 답변
Ahmet Cecen
2014년 8월 22일
I don't have the Global Optimization Toolbox, but I went through your code and my first impression is that your problem could be here:
in FEM2.m line 45
[Ex,Ey,Ez]=coordxtr(Edof,Coord,Dof,3);
reading through your documentation for coordxtr:
nen: number of element nodes
doesn't seem to me like you intend that number to be 3 for the above configuration.
Regardless, your code is most likely breaking here (at coordxtr):
for j = 1:nen
check=Dof(:,1:nend)-ones(n,1)*Edof(i,(j-1)*nend+2:j*nend+1);
[indx,dum]=find(check==0);
nodnum(j)=indx(1);
end
So focus your attention on that.
댓글 수: 8
Ahmet Cecen
2014년 8월 22일
This means you are probably making a mistake in your FEM2 code in the way you are using the coordxtr function or any of the variables you feed there. As in it is a conceptual error, not a straightforward coding error. I cannot help you there, since I don't actually know anything about FEM or the side functions you are using.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!