function I=findduplicate(x);
%FINDDUPLICATE--returns index to duplicate entries in x
%
% I=findduplicate(x);
%
% If x is a vector of numbers, findduplicate will locate the start of any
% consecutive pairs of identical numbers.
%
% Ex:
%    if x=[ 1 1 4 4 2 2 2]
%    the index I will be [1 3 5 6].
%

d=diff(x);
I=find(d==0);
