if statement logical error
Mostra commenti meno recenti
Hello, I am working with image processing toolbox and I keep getting the wrong results the main idea is that I calculate some features form any image and store these values in a row vector (s), and a variable (e) then I compare the list of results with range values in the if statement the problem is it keeps getting the else part even if the if part is right??
this is the if statement part:
if(s(1)<=0.1649 && s(1)>=0.1062)...
&&(s(2)<= 0.9737&& s(2)>=0.9620)...
&&(s(3)<=0.3081 && s(3)>=0.2421)...
&& (s(4)<=0.9501 && s(4)>=0.9278) && (e<=5.4846 && e>=5.1281)
results='Positive Results';
else
results='Negative Results';
end
assume s and e were input as follows
s=[0.1630 0.9710 0.2421 0.9286];
e=5.4846;
please help,thank u in advance..
1 Commento
Junaid
il 1 Dic 2011
Dear friend. I don't see any logical error. Output is Result = 'Positive Results'. This is what it should be as all conditions are true.
Risposta accettata
Più risposte (1)
Junaid
il 1 Dic 2011
Dear when I execute your code, i get the if part not else part. I also checked your all conditions and all conditions are true.
If you are confuse in any part you can check all condition one bye one like this.
s(4)<=0.9501 && s(4)>=0.9278
it should output 1. then you can debug it yourself. So far your all conditions are true and you get Result = ' Positive Results'.
1 Commento
Duaa
il 1 Dic 2011
Categorie
Scopri di più su Common Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!