how to make if statement?
2 次查看(过去 30 天)
显示 更早的评论
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;
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!