Skip to main content

EqualWaves

EqualWaves (waveA, waveB , selector [, tolerance ])

The EqualWaves function compares waveA to waveB. Each wave can be of any data type. It returns 1 for equality and zero otherwise.

Use the selector parameter to determine which aspects of the wave are compared. You can add selector values to test more than one field at a time or pass -1 to compare all aspects.

selectorField** **Compared
1wave data
2wave data type
4wave scaling
8data units
16dimension units
32dimension labels
64wave note
128wave lock state
256data full scale
512dimension sizes

If you use the selectors for wave data, wave scaling, dimension units, dimension labels or dimension sizes, EqualWaves will return zero if the waves have unequal dimension sizes. The other selectors do not require equal dimension sizes.

Details

If you are testing for equality of wave data and if the tolerance is specified, it must be a positive number. The function returns 1 for equality if the data satisfies:

i(waveA[i]waveB[i])2<tolerance.\displaystyle \sum_{i}({ waveA }[i]-{ waveB } [i])^{2}< { tolerance } .

If tolerance is not specified, it defaults to 10-8.

If tolerance is set to zero and selector is set to 1 then the data in the two waves undergo a binary comparison (byte-by-byte).

If tolerance is non-zero then the presence of NaNs at a given point in both waves does not contribute to the sum shown in the equation above when both waves contain NaNs at the same point. A NaN entry that is present in only one of the waves is sufficient to flag inequality. Similarly, INF entries are excluded from the tolerance calculation when they appear in both waves at the same position and have the same signs.

If you are comparing wave data (selector =1) and both waves contain zero points the function returns 1.

The EqualWaves() function comparison of all text fields is case-sensitive.

See Also

MatrixOp equal keyword