??? Index exceeds matrix dimensions.
古いコメントを表示
I keep getting this error every time I run this code. Can you tell me where I am wrong? I have run through the debugger and can't seem to figure out where I went wrong.
K = zeros(3*NN,3*NN);
M = zeros(3*NN,3*NN);
for n = 1:NE
i = Dir(n,2);
j = Dir(n,3);
K(3*i-2:3*i,3*i-2:3*i)= K11(:,:,n) + K(3*i-2:3*i,3*i-2:3*i);
K(3*i-2:3*i,3*j-2:3*j)= K12(:,:,n);
K(3*j-2:3*j,3*i-2:3*i)= K21(:,:,n);
K(3*j-2:3*j,3*j-2:3*j)= K22(:,:,n) + K(3*j-2:3*j,3*j-2:3*j);
M(3*i-2:3*i,3*i-2:3*i)= M11(:,:,n) + M(3*i-2:3*i,3*i-2:3*i);
M(3*i-2:3*i,3*j-2:3*j)= M12(:,:,n);
M(3*j-2:3*j,3*i-2:3*i)= M21(:,:,n);
M(3*j-2:3*j,3*j-2:3*j)= M22(:,:,n) + M(3*j-2:3*j,3*j-2:3*j);
end
3 件のコメント
Azzi Abdelmalek
2012 年 7 月 31 日
編集済み: Azzi Abdelmalek
2012 年 7 月 31 日
what are NN NE Dir,..?
Walter Roberson
2012 年 7 月 31 日
Azzi is right: the information you have given us does not allow us to determine whether 3*i-2 to 3*i and 3*j-2 to 3*j are within the size of K and M; we also cannot tell that the third dimension of K* and M* are at least as big as NE.
Jonathan
2012 年 7 月 31 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!