[Index for tmp_for_tar/dumper]
[Return to Master Index]
cmpany
(tmp_for_tar/dumper/cmpany.m)
Function Synopsis
c = cmpany(x,y)
Help text
c = cmpany(x,y) - Compare octave objects
Returns 1 if x and y are equal, 0 otherwise
See also any2m, any2str, list2str, mat2str, struct2str.
Last modified: August 2001
Cross-Reference Information
This function is called by
Listing of function file tmp_for_tar/dumper/cmpany.m
## c = cmpany(x,y) - Compare octave objects
##
## Returns 1 if x and y are equal, 0 otherwise
##
## See also any2m, any2str, list2str, mat2str, struct2str.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: August 2001
function c = cmpany(x,y)
% printf('cmpany\n') ;
c = 0 ;
if all(size(x)==0) && all(size(y)==0) ,
% printf('EMPTY\n');
c = 1 ;
# cl = class(mat);
elseif is_matrix(x) && is_matrix(y),
if all(size(x) == size(y) ) && all( x(:) == y(:) )
c = 1 ;
end
% printf('MATRIX\n');
elseif isstr(x) && isstr(y),
# mat2 = strrep(mat,'''','''''');
if strcmp(x,y), c = 1 ; end
% printf('STR\n');
elseif is_list(x) && is_list(y),
% printf('LIST\n');
if length(x) == length(y) ,
c = 1 ;
for i = 1:length(x),
## if any(size(nth(x,i))!=size(nth(y,i))) || ...
## any(any(nth(x,i) != nth(y,i))),
if !cmpany(nth(x,i),nth(y,i)) ;
c = 0 ;
break ;
end
end
end
elseif is_struct(x) && is_struct(y) && exist('cmpstruct') == 2 ,
c = cmpstruct(x,y);
% printf('STRUCT\n');
else
% printf('UNKNOWN\n');
printf("Sorry, cmpany doesn't know how to compare \n") ;
keyboard
end
% printf('DONE\n');
end
Produced by oct2html on Tue Aug 7 17:33:07 2001
Cross-Directory links are: ON