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.

 採用された回答

Ahmet Cecen
Ahmet Cecen 2014 年 8 月 22 日

0 投票

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 件のコメント

Hessam
Hessam 2014 年 8 月 22 日
I attached some pic, It may help why I'm getting this error
Please look at these pics and give me some help, I can NOT solve this alone
Ahmet Cecen
Ahmet Cecen 2014 年 8 月 22 日
Did you confirm that your code indeed breaks there?
Hessam
Hessam 2014 年 8 月 22 日
sure
Ahmet Cecen
Ahmet Cecen 2014 年 8 月 22 日
What you sent as a picture is just 1 instance of "check". It must be a different value of "j" that breaks the loop. Put the red dot where it was in the pictures, then manually keep running it, then look at the value of check at the iteration (j) just before the operation breaks.
Pierre Benoit
Pierre Benoit 2014 年 8 月 22 日
編集済み: Pierre Benoit 2014 年 8 月 22 日
You could also type this :
dbstop if error
in the command windows before you run the code so you don't have to go through the loop manually.
Hessam
Hessam 2014 年 8 月 22 日
Ahmet, I did what you said, for the first manual running this comes out (check2) but for the second time I got error.
Thanks my friend
Hessam
Hessam 2014 年 8 月 22 日
Dear Ahmet, I tried the code with variable j.
Please help me out and look these pics
Ahmet Cecen
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 件)

カテゴリ

質問済み:

2014 年 8 月 22 日

コメント済み:

2014 年 8 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by