isequal

Determine whether real-world values of two fi objects are equal, or determine whether properties of two fimath, numerictype, or quantizer objects are equal

Syntax

y = isequal(a,b,...)
y = isequal(F,G,...)
y = isequal(T,U,...)
y = isequal(q,r,...)

Description

y = isequal(a,b,...) returns 1 if all the fi object inputs have the same real-world value. Otherwise, the function returns 0.

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.

y = isequal(F,G,...) returns 1 if all the fimath object inputs have the same properties. Otherwise, the function returns 0.

y = isequal(T,U,...) returns 1 if all the numerictype object inputs have the same properties. Otherwise, the function returns 0.

y = isequal(q,r,...) returns 1 if all the quantizer object inputs have the same properties. Otherwise, the function returns 0.

Examples

collapse all

Use the isequal function to determine if two fi objects have the same real-world value.

a = fi(pi);
b = fi(pi, 1, 32);
y = isequal(a, b)
y = logical
   0

Input a has a 16-bit word length, while input b has a 32-bit word length. The isequal 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 fi object.

a = fi(pi);
b = pi;
y = isequal(a, b)
y = logical
   1

The isequal 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.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a