Determine whether real-world values of two
c = eq(a,b)
a == b
c = eq(a,b) is called for the syntax
== b when
have the same dimensions unless one is a scalar. A scalar can be compared
with another object of any size.
a == b does an element-by-element comparison
b and returns
a matrix of the same size with elements set to
the relation is true, and
0 where the relation
In relational operations comparing a floating-point value to
a fixed-point value, the floating-point value is cast to the same
word length and signedness as the
fi object, with
isequal function to determine if two
fi objects have the same real-world value.
a = fi(pi); b = fi(pi, 1, 32); a == b
ans = logical 0
a has a 16-bit word length, while input
b has a 32-bit word length. The
eq function returns
0 because the two
fi objects do not have the same real-world value.
When comparing a double to a
fi object, the double is cast to the same word length and signedness of the
a = fi(pi); b = pi; a == b
ans = logical 1
eq function casts
b to the same word length as
a, and returns
1. This behavior allows relational operations to work between
fi objects and floating-point constants without introducing floating-point values in generated code.
Usage notes and limitations:
Fixed-point signals with different biases are not supported.