Fixed bugs.
parent
6fff2fe75b
commit
af4005f836
|
@ -38,10 +38,14 @@ if ~isequal(length(A),length(B))
|
||||||
error('compare_vectors_lt:: Input arguments a and b must be of same length!')
|
error('compare_vectors_lt:: Input arguments a and b must be of same length!')
|
||||||
end
|
end
|
||||||
|
|
||||||
if ~ismember(func2str(f),{'lt', 'gt', 'le', 'ge'})
|
fstr = func2str(f);
|
||||||
|
|
||||||
|
if ~ismember(fstr, {'lt', 'gt', 'le', 'ge'})
|
||||||
error('compare_vectors:: First input argument must be one of the following function handles: @lt, @gt, @le or @ge!')
|
error('compare_vectors:: First input argument must be one of the following function handles: @lt, @gt, @le or @ge!')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
strict_inequality = ismember(fstr, {'gt','lt'});
|
||||||
|
|
||||||
if isequal(length(A),1)
|
if isequal(length(A),1)
|
||||||
if feval(f, A, B)
|
if feval(f, A, B)
|
||||||
C = 1;
|
C = 1;
|
||||||
|
@ -50,12 +54,26 @@ if isequal(length(A),1)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if feval(f, A(1), B(1))
|
if feval(f, A(1), B(1))
|
||||||
|
if strict_inequality
|
||||||
C = 1;
|
C = 1;
|
||||||
elseif isequal(A(1),B(1))
|
else
|
||||||
|
if isequal(A(1),B(1))
|
||||||
|
C = compare_vectors(f, A(2:end), B(2:end));
|
||||||
|
else
|
||||||
|
C = 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if strict_inequality
|
||||||
|
if isequal(A(1),B(1))
|
||||||
C = compare_vectors(f, A(2:end), B(2:end));
|
C = compare_vectors(f, A(2:end), B(2:end));
|
||||||
else
|
else
|
||||||
C = 0;
|
C = 0;
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
C = 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
|
|
Loading…
Reference in New Issue