필터 지우기
필터 지우기

if,elseif ,else statements

조회 수: 1 (최근 30일)
VASUNDHARA V
VASUNDHARA V 2022년 2월 26일
편집: Jan 2022년 2월 26일
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
VASUNDHARA V
VASUNDHARA V 2022년 2월 26일
ok i got it ..initially i gave i=1:2 ...i have to initialize upto 9

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by