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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2023년 2월 11일

답변:

2023년 2월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by