1 function res = isequal_ignore_handles(s1,s2)
2 %
function res = isequal_ignore_handles(s1,s2)
4 % generalization of isequal
for structures with possibly
5 % function_handles. as isequal does not work
for these,
6 % function_handles are skipped
9 % s1: general variable to be compared
10 % s2: general variable to be compared
13 % boolean, indicating wether the two variables are identical (
while ignoring
18 if ~isequal(
class(s1),
class(s2))
23 case 'function_handle'
26 case {
'double',
'char',
'single',
'logical',
'rectgrid',
'triagrid',
'onedgrid'}
29 if length(s1)~=length(s2)
34 res = res && isequal_ignore_handles(s1{i},s2{i});
37 case {
'struct',
'feminfo'}
40 if length(intersect(fn1,fn2))~=length(fn1)
47 isequal_ignore_handles(s1.(fn1{i}),s2.(fn1{i}));
51 % Loop over all properties:
58 ise = isequal_ignore_handles(s1.(p{i}),s2.(p{i}));
61 display([
'property ', p{i},
' not equal'])
66 error(
'class type not yet supported');