if (eucli<=0.1980) && (eucli>=0.1990) disp('Happy'); end
Operands to the and && operators must be convertible to logical scalar values.
Error in samptest (line 247) if (eucli<=0.1980) && (eucli>=0.1990)

7 commentaires

KSSV
KSSV le 6 Avr 2017
what is the value of eucli ?
vasantha malairamar
vasantha malairamar le 6 Avr 2017
we got the eucli as 0.1984 it varies for different images but its value must be between 0.1980 and 0.1990
KSSV
KSSV le 6 Avr 2017
eucli = 0.1984 ;
if (eucli<=0.1980) && (eucli>=0.1990)
disp('Happy');
else
disp('unhappy')
end
It is working fine for me without error.
vasantha malairamar
vasantha malairamar le 6 Avr 2017
we run the same code as you have given but it displays 'unhappy'
KSSV
KSSV le 6 Avr 2017
what is your condition actually?
vasantha malairamar
vasantha malairamar le 6 Avr 2017
we have an array of 7 numbers any one of these 7 values ranges between 0.1980 and 0.1990 then it must display happy or else display sad
Jan
Jan le 7 Avr 2017
(eucli<=0.1980) && (eucli>=0.1990)
?? This is mutually exclusive. No number can be smaller than 0.1980 and greater than 0.1990. Either:
(eucli<=0.1980) || (eucli>=0.1990)
or
(eucli>=0.1980) && (eucli<=0.1990)

Connectez-vous pour commenter.

Réponses (1)

Andrei Bobrov
Andrei Bobrov le 6 Avr 2017
Modifié(e) : Andrei Bobrov le 6 Avr 2017

0 votes

Maybe so?
if all(eucli >= 0.1980 & eucli <= 0.1990)
disp('Happy');
else
disp('Sad');
end

3 commentaires

vasantha malairamar
vasantha malairamar le 7 Avr 2017
tnk u so much...it's works for me...
Andrei Bobrov
Andrei Bobrov le 7 Avr 2017
Accept the answer or not?
Mucahid Akyar
Mucahid Akyar le 22 Nov 2017
Modifié(e) : Mucahid Akyar le 22 Nov 2017
how can we do this on for loop? like for(i = 0: 20 & j = 0: 10) this is possible or not?

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by