Index in position 3 exceeds array bounds (must not exceed 1).

조회 수: 1 (최근 30일)
Taylor Davis
Taylor Davis 2020년 2월 25일
답변: Vimal Rathod 2020년 2월 28일
I'm currently changing a 2D Truss program to 3D and im not sure how to change line 22. The excel file is attatched if needed
  댓글 수: 15
Taylor Davis
Taylor Davis 2020년 2월 25일
Ok this is what came up when I did that
Sindar
Sindar 2020년 2월 25일
Ok, lots of thoughts:
Most likely, K and S(ID,ID,ID) should be 6x6x6.
So, it seems like ID should be 1x6, so that S(ID,ID,ID) is 6x6x6. This implies that either NID gain a third element, or there is another element in the ID pattern from NID(1) and NID(2). I couldn't immediately tell you which, but
NID=MEMBERS(i,1:3)
is easy to implement. Then you can check the sizes of everything again and see if they make sense (and, whether the code errors)

댓글을 달려면 로그인하십시오.

답변 (1개)

Vimal Rathod
Vimal Rathod 2020년 2월 28일
Going through the comments it is evident that when calling
S(ID,ID,ID) = S(ID,ID,ID) + K;
The size of S(ID,ID,ID) is 4*4*4 and size of K is 6*6 which doesn't match and thus you will be getting a error as:
Array dimensions must match for binary array op.
You must change your code accordingly making sure that the dimensions match.

카테고리

Help CenterFile Exchange에서 Structural Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by