# HG changeset patch # User John W. Eaton # Date 1294429735 18000 # Node ID 990c9cb52e5f4783b460c591b963b75d14885cd2 # Parent 93a039fe681e97ad32dfa183a35c6cbba60dec99 __isequal__: compare objects as if they are structures diff -r 93a039fe681e -r 990c9cb52e5f scripts/ChangeLog --- a/scripts/ChangeLog Fri Jan 07 14:14:35 2011 -0500 +++ b/scripts/ChangeLog Fri Jan 07 14:48:55 2011 -0500 @@ -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 -r 93a039fe681e -r 990c9cb52e5f scripts/general/private/__isequal__.m --- a/scripts/general/private/__isequal__.m Fri Jan 07 14:14:35 2011 -0500 +++ b/scripts/general/private/__isequal__.m Fri Jan 07 14:48:55 2011 -0500 @@ -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))