Comparevars

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Compares two variables of any type and returns differences.

Synopsis

[status,msg] = comparevars(a,b,options)

Description

Given any two variables (a) and (b), COMPAREVARS looks for any differences. This function operates on any standard MATLAB data type or a DataSet object and does not give an error when variables of two different types are passed.

With no outputs, the differences between the variables (or "None Found") is displayed. With one output, the boolean result of the comparison (status) is returned (1 = variables are completely equivalent). With two outputs, the comparison result (status) is a cell array of strings listing the differences as a description (msg).

Options

  • ignoreclass : { } Cell array of classes which should be ignored during the comparison. If a structure or cell contains any objects of these classes, the values will not be compared. NOTE: any numeric class (double, uint8, single) should be referred to as 'numeric' to ignore comparisons.
  • ignorefield : { } Specifies one or more structure fields which should be ignored (not compared) in any structure.
  • missingfield : [ 'ignore' | {'difference'} ] specifies how to handle when one of two input structures does not contain the same fields as the other. 'ignore' simply ignores missing fields. 'difference' returns this mismatch as a noted difference.
  • breakondiff : [{0}|1] Boolean flag to stop compare when first diff is found.

See Also

cellne