This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Determine whether real-world value of one fi object is greater than another


c = gt(a,b)
a > b


c = gt(a,b) is called for the syntax a > b when a or b is a fi object. a and b must 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 between a and b and returns a matrix of the same size with elements set to 1 where the relation is true, and 0 where the relation is false.

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 best-precision scaling.


collapse all

Use the gt function to determine whether the real-world value of one fi object is greater than another.

a = fi(pi);
b = fi(pi, 1, 32);
a > b
ans =



Input a has a 16-bit word length, while input b has a 32-bit word length. The gt function returns 1 because after quantization, the value of a is greater than that of b.

When comparing a double to a fi object, the double is cast to the same word length and signedness of the fi object.

a = fi(pi);
b = pi;
a > b
ans =



The gt function casts b to the same word length as a, and returns 0 because the two inputs have the same real-world value. This behavior allows relational operations to work between fi objects and floating-point constants without introducing floating-point values in generated code.

Extended Capabilities

See Also

| | | |

Introduced before R2006a

Was this topic helpful?