Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Determine array equality

`tf = isequal(A,B)`

`tf = isequal(A1,A2,...,An)`

`tf = isequal(`

returns
logical `A,B`

)`1`

(`true`

) if `A`

and `B`

are
the same size and their contents are of equal value; otherwise, it
returns logical `0`

(`false`

). The
test compares both real and imaginary parts of numeric arrays. `isequal`

ignores
the data type of the values in determining whether they are equal.
For cell arrays, categorical arrays, tables, or structures, the function
returns logical `1`

(`true`

) only
when all elements and properties are equal. Undefined categorical
elements, `<missing>`

, `NaN`

(Not
a Number), or `NaT`

(Not a Time) values are considered
to be unequal to other elements, as well as themselves.

`tf = isequal(`

returns
logical `A1,A2,...,An`

)`1`

(`true`

) if all the
inputs are numerically equal.

Use

`isequaln`

if you want to test for equality and treat`NaN`

,`NaT`

, or`<missing>`

values as equal.The equality of two function handles depends on how they are constructed. For more information, see Compare Function Handles.

`isequal`

returns logical`0`

(`false`

) for two objects with dynamic properties, even if the properties have the same names and values.`isequal`

compares only stored (non-dependent) properties when testing two objects for equality.When comparing two handle objects, use

`==`

to test whether objects have the same handle. Use`isequal`

to determine if two objects with different handles have equal property values.

Was this topic helpful?