Documentation

gt

Determine whether real-world value of onefiobject is greater than another

Syntax

c = gt(a,b)
a > b

Description

c = gt(a,b)is called for the syntaxa > bwhenaorbis afiobject.aandbmust have the same dimensions unless one is a scalar. A scalar can be compared with another object of any size.

a > bdoes an element-by-element comparison betweenaandband returns a matrix of the same size with elements set to1where the relation is true, and0where 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 thefiobject, with best-precision scaling.

Examples

collapse all

Use thegtfunction to determine whether the real-world value of onefiobject is greater than another.

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

Inputahas a 16-bit word length, while inputbhas a 32-bit word length. Thegtfunction returns1因为尾er quantization, the value ofais greater than that ofb.

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

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

Thegtfunction castsbto the same word length asa, and returns0because the two inputs have the same real-world value. This behavior allows relational operations to work betweenfiobjects and floating-point constants without introducing floating-point values in generated code.

Extended Capabilities

See Also

||||

Introduced before R2006a

Was this topic helpful?