Determine if two dictionary keys are the same
categorical elements, and
<missing> values are considered to be equal
to other such values. Handle objects match if they are the same handle.
keyMatch function determines equivalence on the properties of the
input. For custom classes
keyMatch may need to be overloaded to insure
correct equivalence. For more information on using custom classes with dictionary, see Dictionaries and Custom Classes
Determine if Two Dictionary Keys Are the Same
Dictionaries map unique keys to values. Use the function
keyMatch to determine if keys are the same
Create two structures with two fields.
X = struct("field1",1,"field2",2); Y = struct("field1",1,"field2",2);
keyMatch to determine if
Y are the same as dictionary keys.
ans = logical 1
Y will now be different as dictionary keys.
Y.field1 = 3; keyMatch(X,Y)
ans = logical 0
B — Inputs to be compared (as separate arguments)
scalars | vectors | matrices | multidimensional arrays
Inputs to be compared, specified as scalars, vectors, matrices, or multidimensional arrays
Introduced in R2022b