필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

if statements help, not compare

조회 수: 1 (최근 30일)
Fabio Corres
Fabio Corres 2019년 12월 24일
마감: MATLAB Answer Bot 2021년 8월 20일
hello ı have this recognition but ı cant compare. Rn Gn Bn is Rn=R/R+G+B etc. I've put RnGnBn matrices in addition
if G>R
if R<0.8167
disp('orange class');
end
else
disp (' apple class');
end
code does not fall to the first if

답변 (1개)

Walter Roberson
Walter Roberson 2019년 12월 24일
You do not have an else corresponding to the if on line 2. The else that you have on the 5th line of your code corresponds to the else in line 6 of the algorithm.
You want
if this
if that
%this and that
else
%this but not that
end
else
%not this
end
but what you have is equivalent to
if this
if that
%this and that
end
%case of this but ~that was not tested
else
%not this
end

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by