compare 3 variables in MATLAB

1.6k Views Asked by At

I am wondering how to compare 3 variables in MATLAB, because MATLAB is comparing first 2 and then result against 3rd. To illustrate with example:

(-1 == -1 == -1)

ans =

0

(-1 == -1 == 1)

ans =

1

My dataset that I am comparing has only -1 and +1 values. Is the only solution is to convert everything to 1's and 0's?

1

There are 1 best solutions below

1
On BEST ANSWER

How about:

(a == b) && (b == c)