Relational Operators (handle)

Equality and sorting of handle objects


TF = eq(H1,H2)
TF = ne(H1,H2)
TF = lt(H1,H2)
TF = le(H1,H2)
TF = gt(H1,H2)
TF = ge(H1,H2)


TF = eq(H1,H2) Equal.

TF = ne(H1,H2) Not equal.

TF = lt(H1,H2) Less than.

TF = le(H1,H2) Less than or equal.

TF = gt(H1,H2) Greater than.

TF = ge(H1,H2) Greater than or equal.

For each pair of input arrays (H1 and H2), a logical array of the same size is returned in which each element is an element-wise equality or comparison test result. These methods perform scalar expansion in the same way as the MATLAB® built-in functions. See relationaloperators for more information.

You can make the following assumptions about the result of a handle comparison:

  • The same two handles always compare as equal and the repeated comparison of any two handles always yields the same result in the same MATLAB session.

  • Different handles are always not-equal.

  • The order of handle values is purely arbitrary and has no connection to the state of the handle objects being compared.

  • If the input arrays belong to different classes (including the case where one input array belongs to a non-handle class such as double) then the comparison is always false.

  • If a comparison is made between a handle object and an object of a dominant class, the method of the dominant class is invoked. You should generally test only like objects because a dominant class might not define one of these methods.

  • An error occurs if the input arrays are not the same size and neither is scalar.

Use isequal when you want to determine if handle objects with different handles have the same data in all object properties.

See Also


Was this topic helpful?