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

조회 수: 2 (최근 30일)
Chaudhary P Patel
Chaudhary P Patel 2019년 8월 19일
답변: Chris 2019년 8월 19일
for elem=1:ne %Calling elements
for i=1:4
for j=1:4
if (elem(i,4)==1)
k=eval(['k',num2str(elem),'l']);
else
k=eval(['k',num2str(elem),'l']);
KG(i,j)=k(i,j)+KG(i,j);
end
end
end
end

답변 (1개)

Chris
Chris 2019년 8월 19일
Your first line is making "elem" a scalor but the if test is using it as a martix; this does not work.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by