This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

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.



Compare two HeaderField arrays


field1 == field2
tf = eq(field1,field2)



field1 == field2 compares two HeaderField arrays element by element, returning an array of logical values indicating matching elements. The arrays must have the same dimensions, unless one is a scalar.

Two header fields are equal if they are functionally equivalent, even if they are not identical. Functionally equivalent means both of these conditions are true:

  • Name properties match using a case-insensitive comparison

  • Value properties match. If the convert method is supported for the HeaderField type, MATLAB® uses the isequal method on the results of convert. If convert is not supported, comparisons are based on a case-sensitive match of the Value strings.

The == method compares the Name and Value properties only. The method ignores the actual classes of field1 and field2, since both are instances of the HeaderField class.

tf = eq(field1,field2) is an alternative way to execute field1 == field2. The method returns a logical scalar or array.

Input Arguments

expand all

Header field, specified as a object or a vector of HeaderField objects.

Header field, specified as a object or a vector of HeaderField objects.


expand all

This comparison evaluates to true, even though one object being compared is a HeaderField object and the other is a DateField object.

dt = datetime('now');
HeaderField('Date',dt) == DateField(dt)
ans = logical

Introduced in R2016b