I have this If statement
if abs(DespSubSis(1) - Carga(1)) > abs(PTIE)
k = k + 1;
flag = 1;
elseif abs(DespSubSis(2) - Carga(2)) > abs(PTIE)
k = k + 1;
flag = 1;
end
being
DespSubSis = 700.0000 700.0000
Carga = 850 550
PTIE = 150
The first If returns 0, but the second 1.
Both should returns 0 since It's false 150 > 150.
What's wrong? :(

 채택된 답변

Walter Roberson
Walter Roberson 2018년 11월 10일

0 개 추천

Your values are not exact integers. You should display
DespSubSis - fix(DespSubSis)
Carga - fix(Carga)
You will find something non-zero.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

릴리스

R2017a

태그

Community Treasure Hunt

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

Start Hunting!

Translated by