Main Content

gt

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

Description

A > B returns a logical array with elements set to logical 1 (true) where the real-world values of A is greater than B, when A or B is a fi object. Otherwise, the element is logical 0 (false). The test compares only the real part of numeric arrays.

In relational operations comparing a floating-point value to a fixed-point value, the floating-point value is cast to a fixed-point type that preserves the relative order of the value with respect to the value in the fixed-point fi object.

example

gt(A,B) is an alternate way to execute A > B, but is rarely used.

example

Examples

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 = logical
   1

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 floating-point double is cast to a type that preserves the relative order of the value with respect to the value in the fixed-point fi object. This behavior allows relational operations to work between fi objects and floating-point constants without introducing floating-point values in generated code.

a = fi(pi);
b = pi;
gt(a,b)
ans = logical
   1

Input Arguments

collapse all

Operands, specified as scalars, vectors, matrices, or multidimensional arrays. Inputs A and B must either be the same size or have sizes that are compatible. For more information, see Compatible Array Sizes for Basic Operations.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi
Complex Number Support: Yes

Extended Capabilities

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a

expand all

See Also

| | | |