# HG changeset patch # User John W. Eaton # Date 1294429735 18000 # Node ID 990c9cb52e5f4783b460c591b963b75d14885cd2 # Parent 93a039fe681e97ad32dfa183a35c6cbba60dec99 __isequal__: compare objects as if they are structures diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2011-01-07 John W. Eaton + + * general/private/__isequal__.m: Compare objects as if they are + structures. + 2011-01-07 John W. Eaton * linear-algebra/logm.m: Style fixes. diff --git a/scripts/general/private/__isequal__.m b/scripts/general/private/__isequal__.m --- a/scripts/general/private/__isequal__.m +++ b/scripts/general/private/__isequal__.m @@ -59,7 +59,7 @@ ## All arguments must either be of the same class or they must be ## numeric values. t = (all (strcmp (class(x), - cellfun (@class, varargin, "uniformoutput", false))) + cellfun (@class, varargin, "uniformoutput", false))) || ((isnumeric (x) || islogical (x)) && all (cellfun (@isnumeric, varargin) | cellfun (@islogical, varargin)))); @@ -83,6 +83,12 @@ endwhile endif + ## From here on, compare objects as if they were structures. + if (isobject (x)) + x = struct (x); + varargin = cellfun (@struct, varargin, "uniformoutput", false); + endif + if (t) ## Check individual classes. if (isstruct (x))