Effacer les filtres
Effacer les filtres

if,elseif ,else statements

1 vue (au cours des 30 derniers jours)
VASUNDHARA V
VASUNDHARA V le 26 Fév 2022
Modifié(e) : Jan le 26 Fév 2022
I dnt know what is wrong with my code ..it only prints value upti i==2 then it ends ..i step by step checked it.
for i=1:2
if i==1
d(1,[1,2])=0
d(7,[1,2])=0
d(11,[1,2])=0
elseif i==2
d(9,[1,2])=0
elseif i==3
d(3,[1,2])=0
elseif i==4
d(2,[1,2])=0
d(5,[1,2])=0
elseif i==5
d(7,[1,2])=0
d(11,[1,2])=0
elseif i==6
d(9,[1,2])=0
elseif i==7
d(4,[1,2])=0
d(5,[1,2])=0
elseif i==8
d(8,[1,2])=0
d(9,[1,2])=0
else
if i==9
d(11,[1,2])=0
end
end
  1 commentaire
VASUNDHARA V
VASUNDHARA V le 26 Fév 2022
ok i got it ..initially i gave i=1:2 ...i have to initialize upto 9

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by