Documentation

le

Determine whether real-world value offiobject is less than or equal to another

Syntax

c = le(a,b)
a <= b

Description

c = le(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 thelefunction to determine whether the real-world value of onefiobject is less than or equal to another.

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

Inputahas a 16-bit word length, while inputbhas a 32-bit word length. Thelefunction returns0因为尾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 =logical1

Thelefunction castsbto the same word length asa, and returns1because 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?