MATLAB Answers

0

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

Asked by pramod kumar on 19 Aug 2019
Latest activity Answered by Chris
on 19 Aug 2019
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

  0 Comments

Sign in to comment.

1 Answer

Answer by Chris
on 19 Aug 2019

Your first line is making "elem" a scalor but the if test is using it as a martix; this does not work.

  0 Comments

Sign in to comment.