MATLAB: Integer and identity code

identityinteger

Can you guys help me with this one?
Thanks

Best Answer

It seems straightforward. Use the ‘double equal’ operator == to test for equality.
A 1 means the condition is met, a 0 indicates it was not. To understand the nature of the problem (if it’s not already been explained to you) see Why is 0.3 - 0.2 - 0.1 (or similar) not equal to zero? (link).