Why can't I compare specific types such as, function handles, using the == operation in Matlab?
For instance
@prod == @sum
fails with error
Undefined function 'eq' for input arguments of type 'function_handle'.
Does this mean that this type can support comparison if we just specify overload == for function_handle types?
To test equality of function handles, use the ISEQUAL command instead:
>> isequal(@prod, @sum)
ans =
0
>> isequal(@prod, @prod)
ans =
1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With