*???index exceeds matrix dimensions*
古いコメントを表示
i n my program i have used 'for' loop and 'if' loop at the end i am getting this comment ???index exceeds matrix dimensions after calculating 1 value, where i have to calculate 42 values
for x=1:42;
if x==1
m=Q0;
h=h0;
b1=0;
end
if x==2
m=Q0;
h=(h0+h1)/2;
b1=0;
end
if x==3
m=Q0;
h=h1;
b1=0;
end
if x==4
m=Q30;
h=h1;
b1=30;
end
if x==5
m=Q30;
h=(h1+h2)/2;
b1=30;
end
if x==6
m=Q30;
h=h2;
b1=30;
end
if x==7
m=Qn45;
h=h2;
b1=-45;
end
if x==8
m=Qn45;
h=(h2+h3)/2;
b1=-45;
end
if x==9
m=Qn45;
h=h3;
b1=-45;
end
*an so on*
%---------------- --------------------%
Ex=ex0+(h)*Kx;
Ey=ey0+(h)*Ky;
Gxy=Gxy0+(h)*Kxy;
Gxy1=Gxy/2;
GSN=[Ex,Ey,Gxy]
GSN1=[Ex;Ey;Gxy1];
%------------------------------------%
GSS=m*GSN
b=b1*(3.14/180);
C=cos(b);
S=sin(b);
%------------------------------------%
T=[C^2,S^2,(2*S*C); S^2,C^2,(-2*S*C);(-S*C),(S*C),((C^2)-(S^2))]
3 件のコメント
Jan
2011 年 11 月 22 日
Please post a copy of the complete error message and the line, which causes the error. Without seeing this line, even wild guessing would be too random.
Andrei Bobrov
2011 年 11 月 22 日
NOW?
%---------
for x=1:42;
...
end
Ex=ex0+(h)*Kx;
...
T=[C^2,S^2,(2*S*C); S^2,C^2,(-2*S*C);(-S*C),(S*C),((C^2)-(S^2))]
%---------------------------------------
OR
%-------------------------------
for x=1:42;
...
Ex=ex0+(h)*Kx;
...
T=[C^2,S^2,(2*S*C); S^2,C^2,(-2*S*C);(-S*C),(S*C),((C^2)-(S^2))]
end
%----------------------------------
Walter Roberson
2011 年 12 月 8 日
There is no such thing as an if loop.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!