how to make if statement?

조회 수: 3 (최근 30일)
Latifah
Latifah 2023년 2월 11일
답변: Voss 2023년 2월 11일
i want to make x(6) and x(7) condition with if , and it's look wrong, can you help me to fix it
H=0;
if (x(6)>0,x(7)>0)
H = 1;
  댓글 수: 1
Latifah
Latifah 2023년 2월 11일
is it necessary to separate the two statements for x(6) and x(7)?

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

채택된 답변

Voss
Voss 2023년 2월 11일
If you want H to be 1 when x(6)>0 and x(7)>0, then:
H=0;
if x(6)>0 && x(7)>0
H = 1;
end
If you want H to be 1 when x(6)>0 or x(7)>0, then:
H=0;
if x(6)>0 || x(7)>0
H = 1;
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by