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

2 vues (au cours des 30 derniers jours)
Chaudhary P Patel
Chaudhary P Patel le 19 Août 2019
Réponse apportée : Chris le 19 Août 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

Réponses (1)

Chris
Chris le 19 Août 2019
Your first line is making "elem" a scalor but the if test is using it as a martix; this does not work.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by