Performs an element-by-element greater than comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = 1; b = 2; print(a > b); a = 'a'; b = 'hml'; print(a > b); a = true; b = false; print(a > b); // equivalent to compare 1 > 0 a = [ 1 3 4]; b = [ 1 2 4]; print(a > b); a = [ 1 3 4]; b = [ 1+1i 2 4+6i]; print(a > b); // with complex number only the real part is compared equivalent to print(Real(a) > Real(b)); |
Performs an element-by-element less than comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = [ 1 3 4]; b = [ 1 2 4]; print(a < b); a = [ 1 3 4]; b = [ 1+1i 2 4+6i]; print(a < b); // with complex number only the real part is compared equivalent to print(Real(a) < Real(b)); |
Performs an element-by-element greater than or equal comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = [ 1 3 4]; b = [ 1 2 4]; print(a >= b); a = [ 1 3 4]; b = [ 1i 2 4+6i]; print(a >= b); // with complex number only the real part is compared equivalent to print(Real(a) >= Real(b)) |
Performs an element-by-element less than or equal comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = [ 1 3 4]; b = [ 1 2 4]; print(a <= b); a = [ 1 3 4]; b = [ 1i 2 4+6i]; print(a <= b); // with complex number only the real part is compared equivalent to print(Real(a) <= Real(b)) |
Performs an element-by-element equal comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = [ 1 3 4]; b = [ 1 2 4]; print(a == b); a = [ 1 3 4]; b = [ 1+1i 3 4+6i]; print(a == b); // here the real part and imaginary part are compared print((Real(a) == Real(b)) and (Imag(a) == Imag(b))); // equivalent to a == b |
Performs an element-by-element, not equal comparison of the first argument against the second one. The arguments must be same-sized (unless the second argument is a scalar). It returns a logical array/matrix of the same size as the first argument, with elements set to logical 1 where the relation is true, and elements set to logical 0 where it is not. If the second argument is a scalar, all entries of the first argument are compared against this. Examplea = [ 1 3 4]; b = [ 1 2 4]; print(a != b); a = [ 1 3 4]; b = [ 1+1i 3 4+6i]; print(a != b); // here the real part and imaginary part are compared print((Real(a) != Real(b)) or (Imag(a) != Imag(b))); // equivalent to a != b |
See Also