Borrar filtros
Borrar filtros

if,elseif ,else statements

1 visualización (últimos 30 días)
VASUNDHARA V
VASUNDHARA V el 26 de Feb. de 2022
Editada: Jan el 26 de Feb. de 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 comentario
VASUNDHARA V
VASUNDHARA V el 26 de Feb. de 2022
ok i got it ..initially i gave i=1:2 ...i have to initialize upto 9

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by