Filter löschen
Filter löschen

how to use AND operation

1 Ansicht (letzte 30 Tage)
vasantha malairamar
vasantha malairamar am 6 Apr. 2017
Bearbeitet: Mucahid Akyar am 22 Nov. 2017
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 Kommentare
vasantha malairamar
vasantha malairamar am 6 Apr. 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 am 7 Apr. 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)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 6 Apr. 2017
Bearbeitet: Andrei Bobrov am 6 Apr. 2017
Maybe so?
if all(eucli >= 0.1980 & eucli <= 0.1990)
disp('Happy');
else
disp('Sad');
end
  3 Kommentare
Andrei Bobrov
Andrei Bobrov am 7 Apr. 2017
Accept the answer or not?
Mucahid Akyar
Mucahid Akyar am 22 Nov. 2017
Bearbeitet: Mucahid Akyar am 22 Nov. 2017
how can we do this on for loop? like for(i = 0: 20 & j = 0: 10) this is possible or not?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by